Skip to content

An array TestCase parameter can be assigned to an IEnumerable<T>#924

Merged
mikkelbu merged 1 commit intomasterfrom
Issue922_GenericTestMethods
Oct 6, 2025
Merged

An array TestCase parameter can be assigned to an IEnumerable<T>#924
mikkelbu merged 1 commit intomasterfrom
Issue922_GenericTestMethods

Conversation

@manfred-brands
Copy link
Copy Markdown
Member

Fixes #922

@manfred-brands manfred-brands requested a review from Copilot October 5, 2025 06:25
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 where array TestCase parameters could not be properly assigned to generic enumerable types. The fix enhances the type compatibility checking to handle array-to-enumerable conversions.

  • Enhanced type compatibility checking to support array-to-enumerable conversions for TestCase parameters
  • Refactored nullable type handling and enum conversion logic for better clarity
  • Added comprehensive test coverage for various generic enumerable types

Reviewed Changes

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

File Description
src/nunit.analyzers/Extensions/AttributeArgumentTypedConstantExtensions.cs Enhanced CanAssignTo method to handle array-to-enumerable conversions and refactored type handling logic
src/nunit.analyzers.tests/TestCaseUsage/TestCaseUsageAnalyzerTests.cs Added test cases to verify array parameters work with generic enumerable types

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

Copy link
Copy Markdown
Member

@mikkelbu mikkelbu left a comment

Choose a reason for hiding this comment

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

Thanks for the fix @manfred-brands. I'll merge it now

@mikkelbu mikkelbu merged commit 744e49d into master Oct 6, 2025
7 checks passed
@mikkelbu mikkelbu deleted the Issue922_GenericTestMethods branch October 6, 2025 19:54
@mikkelbu mikkelbu added this to the Release 4.11 milestone Oct 6, 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.

NUnit1001 - false positive for arguments with generic parameters

3 participants