site/xunit.analyzers/rules/xUnit2001.md
Assert.Equals or Assert.ReferenceEquals is used.
Assert.Equals does not assert that two objects are equal; it exists only to hide the static Equals method inherited from object. It's a similar story for Assert.ReferenceEquals.
To fix a violation of this rule, use Assert.Equal instead of Equals and Assert.Same instead of ReferenceEquals.
using Xunit;
public class xUnit2001
{
[Fact]
public void TestMethod()
{
var result = 21 * 2;
Assert.Equals(42, result);
}
}
using Xunit;
public class xUnit2001
{
[Fact]
public void TestMethod()
{
var result = 21 * 2;
Assert.Equal(42, result);
}
}