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.IsAssignableFrom that caused a build error after upgrading to latest NUnit 4.2.2 #790

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

Comments

@MCPtz
Copy link

MCPtz commented Oct 28, 2024

NUnit.Analyzers 4.3.0 missed an Assert.IsAssignableFrom 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.

Fixed manually by doing this:
Assert.IsAssignableFrom<ClassName>(objectVariable); -> Assert.That(objectVariable, Is.AssignableFrom(typeof(ClassName)));

@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.IsAssignableFrom and Assert.IsNotAssignableFrom are not tested. I will update the tests and create a analyzer rule for these.

Same for IsInstanceOf and IsNotInstanceOf.

@manfred-brands manfred-brands self-assigned this Oct 28, 2024
@mikkelbu
Copy link
Member

I'll close #742 as a duplicate of this

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.

3 participants