Skip to content

AssertAreEqual analyzer does not trigger if the expected value is null #171

@robertMSFTE

Description

@robertMSFTE

Description

AssertAreEqual analyzer does not seem to trigger if the expected value is null.

Complete minimal example reproducing the issue

namespace TestProject
{
    using Microsoft.VisualStudio.TestTools.UnitTesting;

    [TestClass]
    public class UnitTest
    {
        [TestMethod]
        public void TestMethod1()
        {
            int? x = null;

            Assert.AreEqual(5, x); // WORKS 
            Assert.AreEqual(null, x); // DOES NOT WORK
        }
    }
}

Expected behavior:

Analyzer triggers and suggests to use fluent assertions.

Actual behavior:

Analyzer does not show a suggestion.

Versions

  • Which version of Fluent Assertions Analyzers are you using? 0.17.2
  • Which .NET runtime and version are you targeting? .NET 6.0.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions