Skip to content

[Feature]: improvements to analyzer when migrating from NUnit to TUnit #6338

Description

@vpenades

Problem Statement

I've found these nuisances when using the TUnit analyzer to migrate from TUnit.

These are the conversions I've found missing:

NUnit Expected in TUnit
Assert.That(boolean); await Assert.That(boolean).IsTrue();
TestContext.WriteLine(string); Console.WriteLine(string);
TestContext.Out.WriteLine(string); Console.Out.WriteLine(string);
TestContext.CurrentContext.TestDirectory System.AppContext.BaseDirectory
TestContext.CurrentContext.WorkDirectory System.AppContext.BaseDirectory
TestContext.AddTestAttachment(string filePath) TestContext.Current!.Output.AttachArtifact(string filePath)

notice that some TestContext.* NUnit methods are shortcuts for TestContext.CurrentContext.*

Proposed Solution

Please, include these use cases in the analyzer

Alternatives Considered

No response

Feature Category

Test Discovery / Attributes

How important is this feature to you?

None

Additional Context

No response

Contribution

  • I'm willing to submit a pull request for this feature

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions