-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
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
New diagnostic: Consider using Assert.ThatAsync instead of Assert.That #759
Comments
The original test more likely looks like: [Test]
public void Before()
{
Assert.That(await GetFourtyTwoAsync(), Is.EqualTo(42));
Assert.That(await GetFourtyTwoAsync("hello world"), Is.EqualTo(42));
} So any CodeFix would also possibly have to change the method declaration. |
Filter by NUnit version, support ConfigureAwait and non-first argument Cleanup
Note that these are bad examples as the The only place where you would want to use
|
I don't mind putting NUnit4 only diagnostics in the 4XXX range. |
Arguably, one of the biggest advantages of using NUnit 4 is: Proper async/await, you can now await the Asserts. However, it appears that
NUnit.Analyzers
doesn't have an analyzer or a codefix for that.Consider the following sync-over-async tests:
It'd be great if these could be fixed to:
Personally, I think it'd be neat if we could bundle all NUnit 4-related changes to NUnit4XXX. Thoughts? (It does raise the question of whether we should reserve 5XXX or above as well... 🤷)
The text was updated successfully, but these errors were encountered: