-
-
Notifications
You must be signed in to change notification settings - Fork 111
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Description
The TUNU0001 NUnit migration code fixer converts NUnit attributes to TUnit attributes, but does not remove the using NUnit.Framework; directive. This results in CS0246 errors after migration because the NUnit package is typically removed.
Reproduction Steps
- Create a test file with NUnit:
using NUnit.Framework;
[TestFixture]
public class MyTests
{
[Test]
public void TestMethod()
{
Assert.AreEqual(1, 1);
}
}- Run the TUNU0001 code fixer:
dotnet format analyzers --severity info --diagnostics TUNU0001 --framework net10.0- Remove the NUnit package:
dotnet remove package NUnit
dotnet remove package NUnit3TestAdapter- Build the project
Expected Behavior
The code fixer should remove the using NUnit.Framework; directive along with converting the attributes.
Actual Behavior
The using NUnit.Framework; directive remains, causing CS0246 errors:
error CS0246: The type or namespace name 'NUnit' could not be found
Workaround
Manually remove all using NUnit.Framework; directives:
find . -name "*.cs" -exec sed -i '/using NUnit\.Framework;/d' {} \;Environment
- TUnit version: 1.11.64
- .NET SDK: 10.0.102
Tests should be added to verify the code fixer removes NUnit using directives.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working