Description
When running the xUnit to TUnit migration code fixer using dotnet format analyzers, the Fix All action fails with the message:
Unable to fix TUXU0001. Code fix XUnitMigrationCodeFixProvider didn't return a Fix All action.
This prevents automated batch migration of test files.
Steps to Reproduce
- Create a test project with xUnit tests
- Add TUnit package (version 1.11.*)
- Add the following to the csproj:
<TUnitImplicitUsings>false</TUnitImplicitUsings>
<TUnitAssertionsImplicitUsings>false</TUnitAssertionsImplicitUsings>
- Run:
dotnet format analyzers --severity info --diagnostics TUXU0001
Expected Behavior
The code fixer should convert all xUnit tests to TUnit format in batch mode.
Actual Behavior
The fixer reports "Unable to fix TUXU0001. Code fix XUnitMigrationCodeFixProvider didn't return a Fix All action" and only partially converts files.
In my test case with ~85 test files:
- Only ~54 files (~63%) were converted to use
[Test] attribute
- ~31 files (~37%) were not converted at all and still have
[Fact] attribute
Environment
- TUnit Version: 1.11.*
- .NET SDK: 10.0.102
- OS: Windows
Additional Context
The migration documentation at https://tunit.dev/docs/migration/xunit recommends using dotnet format analyzers for batch migration, but this approach doesn't work due to the Fix All action not being implemented.
Suggested Fix
The XUnitMigrationCodeFixProvider needs to implement the GetFixAllProvider() method to return a proper FixAllProvider that can handle batch operations.
Tests Needed
Please add tests to verify:
- Fix All in Document scope works
- Fix All in Project scope works
- Fix All in Solution scope works
Description
When running the xUnit to TUnit migration code fixer using
dotnet format analyzers, the Fix All action fails with the message:This prevents automated batch migration of test files.
Steps to Reproduce
dotnet format analyzers --severity info --diagnostics TUXU0001Expected Behavior
The code fixer should convert all xUnit tests to TUnit format in batch mode.
Actual Behavior
The fixer reports "Unable to fix TUXU0001. Code fix XUnitMigrationCodeFixProvider didn't return a Fix All action" and only partially converts files.
In my test case with ~85 test files:
[Test]attribute[Fact]attributeEnvironment
Additional Context
The migration documentation at https://tunit.dev/docs/migration/xunit recommends using
dotnet format analyzersfor batch migration, but this approach doesn't work due to the Fix All action not being implemented.Suggested Fix
The
XUnitMigrationCodeFixProviderneeds to implement theGetFixAllProvider()method to return a properFixAllProviderthat can handle batch operations.Tests Needed
Please add tests to verify: