We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I've noticed the following diagnotics:
We can take a step further and add a new diagnostic: "Split up ternaries for better assertion messages in case of failure"
Consider the following setup (context):
private record Japanese(bool IsRoyal, string FirstName, string? LastName);
Now, suppose there's an assertion like this:
var japanese = new Japanese(IsRoyal: false, FirstName: "Hayao", LastName: "Miyazaki"); Assert.That(japanese.IsRoyal ? japanese.LastName is null : japanese.LastName is not null);
The new diagnostic can convert this to
if (japanese.IsRoyal) { Assert.That(japanese.LastName is null); } else { Assert.That(japanese.LastName is not null); }
Once #746 is complete, NUnit2010 will again suggest
if (japanese.IsRoyal) { Assert.That(japanese.LastName, Is.Null); } else { Assert.That(japanese.LastName, Is.Not.Null); }
which will eventually give you a good error message.
The text was updated successfully, but these errors were encountered:
Not sure if we want to go that far rewriting code. The user might like the ternary operator. It could also be written as:
var japanese = new Japanese(IsRoyal: false, FirstName: "Hayao", LastName: "Miyazaki"); Assert.That(japanese.LastName, japanese.IsRoyal ? Is.Null : Is.Not.Null);
Sorry, something went wrong.
No branches or pull requests
I've noticed the following diagnotics:
We can take a step further and add a new diagnostic: "Split up ternaries for better assertion messages in case of failure"
Consider the following setup (context):
Now, suppose there's an assertion like this:
The new diagnostic can convert this to
Once #746 is complete, NUnit2010 will again suggest
which will eventually give you a good error message.
The text was updated successfully, but these errors were encountered: