Skip to content

Fix NUnit1001 with multiple args#915

Merged
manfred-brands merged 1 commit intonunit:masterfrom
cbersch:fix-testcaseusage-with-multiple-args
Sep 26, 2025
Merged

Fix NUnit1001 with multiple args#915
manfred-brands merged 1 commit intonunit:masterfrom
cbersch:fix-testcaseusage-with-multiple-args

Conversation

@cbersch
Copy link
Copy Markdown
Contributor

@cbersch cbersch commented Sep 23, 2025

Fixes #914

Comment thread src/nunit.analyzers/Extensions/AttributeDataExtensions.cs
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an issue with NUnit analyzer rule NUnit1001 when handling TestCase attributes with multiple arguments. The fix ensures proper parameter type mismatch detection for all argument positions, not just single or array-based arguments.

  • Adds fallback logic to handle constructor argument syntax retrieval for multi-argument scenarios
  • Includes comprehensive test coverage for multiple argument type mismatch scenarios

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/nunit.analyzers/Extensions/AttributeDataExtensions.cs Adds else clause to handle constructor argument syntax for non-array initializer cases
src/nunit.analyzers.tests/TestCaseUsage/TestCaseUsageAnalyzerTests.cs Adds two new test cases for multi-argument type mismatch validation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Copy Markdown
Member

@manfred-brands manfred-brands left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @cbersch
Nice work including tests.

@manfred-brands manfred-brands merged commit ef6626b into nunit:master Sep 26, 2025
6 checks passed
@cbersch cbersch deleted the fix-testcaseusage-with-multiple-args branch September 26, 2025 09:59
@mikkelbu mikkelbu added this to the Release 4.11 milestone Sep 27, 2025
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 this pull request may close these issues.

Wrong position of NUnit1001 diagnostic for TestCase with four parameters or more

4 participants