Description
When running the TUnit NUnit migration code fixer using dotnet format analyzers --severity info --diagnostics TUNU0001, the using NUnit.Framework; statements are not removed from the migrated files, even though TUnit usings are added.
Steps to Reproduce
- Create a project with NUnit tests
- Add TUnit packages
- Run
dotnet format analyzers --severity info --diagnostics TUNU0001
- Build the project
Expected Behavior
The using NUnit.Framework; statements should be removed after migration since NUnit is no longer used.
Actual Behavior
The NUnit using statements remain, causing build errors when NUnit packages are removed:
error CS0246: The type or namespace name 'NUnit' could not be found
Example
Before migration:
using NUnit.Framework;
[TestFixture]
public class MyTests
{
[Test]
public void MyTest()
{
Assert.IsNotNull(someValue);
}
}
After migration (current):
using System.Threading.Tasks;
using TUnit.Core;
using TUnit.Assertions;
using static TUnit.Assertions.Assert;
using TUnit.Assertions.Extensions;
// ... license header ...
using NUnit.Framework; // <-- Still present
public class MyTests
{
[Test]
public async Task MyTest()
{
await Assert.That(someValue).IsNotNull();
}
}
Expected after migration:
using System.Threading.Tasks;
using TUnit.Core;
using TUnit.Assertions;
using static TUnit.Assertions.Assert;
using TUnit.Assertions.Extensions;
// ... license header ...
// No NUnit using statement
public class MyTests
{
[Test]
public async Task MyTest()
{
await Assert.That(someValue).IsNotNull();
}
}
Environment
- TUnit version: 1.9.91
- .NET version: .NET 8.0
- OS: Windows
Description
When running the TUnit NUnit migration code fixer using
dotnet format analyzers --severity info --diagnostics TUNU0001, theusing NUnit.Framework;statements are not removed from the migrated files, even though TUnit usings are added.Steps to Reproduce
dotnet format analyzers --severity info --diagnostics TUNU0001Expected Behavior
The
using NUnit.Framework;statements should be removed after migration since NUnit is no longer used.Actual Behavior
The NUnit using statements remain, causing build errors when NUnit packages are removed:
Example
Before migration:
After migration (current):
Expected after migration:
Environment