[Test]
public void SampleTest()
{
object value = "Hello, World!";
ClassicAssert.IsTrue(value is string);
}
This code will trigger two warnings:
NUnit2003: Consider using the constraint model, Assert.That(expr, Is.True), instead of the classic model, ClassicAssert.IsTrue(expr)
NUnit2055: Consider using Is.InstanceOf<string> instead of 'is string' expression for better assertion messages
I have this as .editorconfig to turn them both into warnings:
[*.cs]
dotnet_analyzer_diagnostic.category-Assertion.severity = warning
If I apply all code fixes (dotnet format), NUnit2055 will be applied first and generate this:
ClassicAssert.IsTrue(value, Is.InstanceOf<string>());
which doesn't compile...
If I explicitly tell it to fix NUnit2003 first, this doesn't happen.
This code will trigger two warnings:
NUnit2003: Consider using the constraint model, Assert.That(expr, Is.True), instead of the classic model, ClassicAssert.IsTrue(expr)NUnit2055: Consider using Is.InstanceOf<string> instead of 'is string' expression for better assertion messagesI have this as
.editorconfigto turn them both into warnings:If I apply all code fixes (
dotnet format), NUnit2055 will be applied first and generate this:which doesn't compile...
If I explicitly tell it to fix NUnit2003 first, this doesn't happen.