Skip to content

fix: Correct codefix for test method signature for Assert.EnterMultipleScope#890

Merged
mikkelbu merged 1 commit intomasterfrom
fix/correct-multiple-scope-code-fix
Jun 12, 2025
Merged

fix: Correct codefix for test method signature for Assert.EnterMultipleScope#890
mikkelbu merged 1 commit intomasterfrom
fix/correct-multiple-scope-code-fix

Conversation

@mikkelbu
Copy link
Copy Markdown
Member

Fixes #888

@mikkelbu mikkelbu requested a review from Copilot June 12, 2025 14:34
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 pull request fixes the test method signature for Assert.EnterMultipleScope by ensuring that the code fix correctly updates async test methods. Key changes include:

  • Addition of tests for both ValueTask and Task-returning methods using Assert.MultipleAsync.
  • Updates to the code fix logic in UseAssertEnterMultipleScopeCodeFix, replacing the IsAsyncTaskMethod check with a direct async modifier check.
  • Enhancements to diagnostic tests verifying the analyzer behavior for multiple async contexts.

Reviewed Changes

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

File Description
src/nunit.analyzers.tests/UseAssertEnterMultipleScope/UseAssertEnterMultipleScopeCodeFixTests.cs Adds tests verifying the code fix correctly replaces Assert.MultipleAsync with using Assert.EnterMultipleScope.
src/nunit.analyzers.tests/UseAssertEnterMultipleScope/UseAssertEnterMultipleScopeAnalyzerTests.cs Introduces new tests for diagnostic analysis on async methods.
src/nunit.analyzers.codefixes/UseAssertEnterMultipleScope/UseAssertEnterMultipleScopeCodeFix.cs Updates the condition for applying the code fix by checking for the async modifier, eliminating the legacy IsAsyncTaskMethod.

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 @mikkelbu for the quick fix.
Looks good to me.

@mikkelbu mikkelbu merged commit 3e29544 into master Jun 12, 2025
7 checks passed
@mikkelbu mikkelbu deleted the fix/correct-multiple-scope-code-fix branch June 12, 2025 15:14
@mikkelbu mikkelbu added this to the Release 4.9.1 milestone Jun 12, 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.

Assert.MultipleAsync -> EnterMultipleScope autofix produce invalid code

3 participants