Skip to content

NUnit2056: Also keep leading trivia#900

Merged
mikkelbu merged 1 commit intomasterfrom
Issue/899-NUnit2056
Jul 28, 2025
Merged

NUnit2056: Also keep leading trivia#900
mikkelbu merged 1 commit intomasterfrom
Issue/899-NUnit2056

Conversation

@manfred-brands
Copy link
Copy Markdown
Member

Fixes #899

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 (#899) where the UseAssertEnterMultipleScopeCodeFix was not preserving leading trivia (such as comments) when transforming Assert.Multiple calls to use Assert.EnterMultipleScope(). The fix ensures that any comments or whitespace before the Assert.Multiple statement are maintained in the transformed code.

  • Updated the code fix to preserve leading trivia when creating the using statement
  • Added a test case to verify that leading trivia (comments) are properly preserved during the transformation

Reviewed Changes

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

File Description
UseAssertEnterMultipleScopeCodeFix.cs Modified to capture and apply leading trivia to the generated using statement
UseAssertEnterMultipleScopeCodeFixTests.cs Added test case to verify leading trivia preservation

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.

LGTM - thanks for the fix @manfred-brands

@mikkelbu mikkelbu merged commit 6ccda8c into master Jul 28, 2025
7 checks passed
@mikkelbu mikkelbu deleted the Issue/899-NUnit2056 branch July 28, 2025 09:01
@mikkelbu mikkelbu added this to the Release 4.10 milestone Jul 28, 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.

NUnit2056 analyzer's code fix removes comments and empty lines above it.

3 participants