Skip to content
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

NUnit.Analyzers 4.3.0 missed an Assert.Positive that caused a build error after upgrading to latest NUnit 4.2.2 #789

Open
MCPtz opened this issue Oct 28, 2024 · 1 comment · May be fixed by #791
Assignees

Comments

@MCPtz
Copy link

MCPtz commented Oct 28, 2024

NUnit.Analyzers 4.3.0 missed an Assert.Positive that caused a build error after upgrading to NUnit 4.2.2, from NUnit 3.13.3

That is there was no build error or warning when on NUnit 3.13.3 and building with NUnit.Analyzers 4.3.0.

Or if there was a warning, I missed it because I had tens of thousands of changes to make.

I suggest this becomes a build error for NUnit.Analyzers.

In this case, it was a double:

var elapsedTime1 = results.DurationInSeconds;//NOTE: elapsedTime1 is a double
Assert.Positive(elapsedTime1);

Which I changed to:

Assert.That(elapsedTime1, Is.GreaterThanOrEqualTo(0));

I just grabbed the excerpt from our test to make this a quick bug report.

@manfred-brands
Copy link
Member

@OsirisTerje This slipped through because when I ensured all tests in the legacy assembly were converted, I forgot to check the test coverage. Assert.Positive and Assert.Negative are not tested. I will update the tests and create a analyzer rule for these.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants