site/xunit.analyzers/rules/xUnit2006.md
A violation of this rule occurs when the generic overloads of Assert.Equal or Assert.StrictEqual are used with string.
There is an optimized overload of Assert.Equal for string arguments.
To fix a violation of this rule, use the non-generic version of Assert.Equal with the string overload.
using Xunit;
public class xUnit2006
{
[Fact]
public void TestMethod()
{
var result = "foo";
Assert.Equal<string>("foo", result);
}
}
using Xunit;
public class xUnit2006
{
[Fact]
public void TestMethod()
{
var result = "foo";
Assert.Equal("foo", result);
}
}