Skip to content

Conversation

@thomhurst
Copy link
Owner

Summary

  • Add comprehensive kitchen sink tests for NUnit, MSTest, and XUnit migrations covering setup/teardown hooks, various test attributes, assertion methods, collection assertions, and skip/ignore functionality
  • Fix NUnit migration code fixer to handle Does.Contain(), Contains.Item(), and convert Description attribute to [Property("Description", "...")]
  • All 864 migration tests pass (520 NUnit + 144 MSTest + 208 XUnit)

Test plan

  • Run NUnit migration tests: dotnet test -- --treenode-filter "/*/*/NUnitMigrationAnalyzerTests/*" - 520 tests pass
  • Run MSTest migration tests: dotnet test -- --treenode-filter "/*/*/MSTestMigrationAnalyzerTests/*" - 144 tests pass
  • Run XUnit migration tests: dotnet test -- --treenode-filter "/*/*/XUnitMigrationAnalyzerTests/*" - 208 tests pass

🤖 Generated with Claude Code

… fixers

- Add comprehensive kitchen sink tests for NUnit, MSTest, and XUnit migrations
  covering setup/teardown hooks, various test attributes, assertion methods,
  collection assertions, and skip/ignore functionality

- Fix NUnit migration code fixer to handle:
  - Does.Contain() -> .Contains()
  - Contains.Item() -> .Contains()
  - Description attribute -> [Property("Description", "...")]

- Update test expectation: NUnit Description attribute now converts to Property
  instead of being removed

- All 864 migration tests pass (520 NUnit + 144 MSTest + 208 XUnit)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@thomhurst
Copy link
Owner Author

Summary

Adds comprehensive migration test coverage (864 tests) and fixes critical bugs in code fixers for NUnit/MSTest/XUnit migration: stale node references in multi-class files, sibling attribute preservation, and NUnit assertion/attribute handling improvements.

Critical Issues

None found ✅

Suggestions

Code Quality Observations (Non-blocking)

  1. BaseMigrationCodeFixProvider.cs:142-171 - The CleanupClassMemberLeadingTrivia fix properly addresses the Roslyn stale node reference bug by using a while loop with re-querying instead of iterating over a pre-collected list. This is the correct approach for working with immutable syntax trees.

  2. BaseMigrationCodeFixProvider.cs:264-267 - The AttributeRewriter fix correctly prevents early return when converting hook attributes, preserving sibling attributes. This addresses the bug where [SetUp, Category("Unit")] would lose the Category attribute.

  3. NUnitMigrationCodeFixProvider.cs:2077-2096 - Lifecycle method visibility fix properly handles removing existing access modifiers before adding public. The trivia handling looks correct.

  4. Test Coverage - The kitchen sink tests provide excellent coverage:

    • 520 NUnit tests
    • 144 MSTest tests
    • 208 XUnit tests
    • Tests explicitly cover the bugs being fixed (sibling attributes, multiple classes)

TUnit Rules Compliance

  • No dual-mode changes (not touching source-gen or reflection paths)
  • No snapshot updates needed (not changing generator output or public APIs)
  • No VSTest dependencies
  • No blocking on async operations
  • No hot path performance concerns
  • No AOT compatibility issues

Verdict

APPROVE - No critical issues. The changes properly fix Roslyn syntax tree mutation bugs and add comprehensive test coverage. All 864 tests pass as documented.

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.

2 participants