Boolean assertions should not be negated
This rule is triggered when you call a boolean assertion with a negated expression.
The message that results from a negated expression is often less clear than the one that would result from a positive expression.
To fix a violation of this rule, remove the negation and invert the assertion.
using Xunit;
public class TestClass
{
[Fact]
public void TestMethod()
{
Assert.True(!condition);
}
}
using Xunit;
public class TestClass
{
[Fact]
public void TestMethod()
{
Assert.False(condition);
}
}