NUnit1001 - false positive for arguments with nullable enum parameters#940
NUnit1001 - false positive for arguments with nullable enum parameters#940mikkelbu merged 2 commits intonunit:masterfrom
Conversation
@dotnet-policy-service agree |
|
Also fixes #938 |
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a false positive in NUnit analyzer rule NUnit1001 when dealing with nullable enum parameters in TestCase attributes. The analyzer was incorrectly flagging valid test cases that pass null or enum values to nullable enum parameters.
- Fixed type casting issue in AttributeArgumentTypedConstantExtensions to properly handle nullable enum types
- Added comprehensive test coverage for nullable enum scenarios
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/nunit.analyzers/Extensions/AttributeArgumentTypedConstantExtensions.cs | Fixed type casting to properly resolve enum underlying type for nullable enums |
| src/nunit.analyzers.tests/TestCaseUsage/TestCaseUsageAnalyzerTests.cs | Added test cases for nullable enum parameter scenarios |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
That would be much appreciated @maksim-sovkov. The current contribution looks great, but additional test for ValueAttribute would make it even better 👍 |
…terIsArrayOfEnum tests
Done. |
mikkelbu
left a comment
There was a problem hiding this comment.
LGTM - thanks for the quick contribution @maksim-sovkov. I'll try to get a release out tomorrow with the fix
Fixes #939