Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AvaloniaTest] results in incorrect TestContext.CurrentContext.Test.MethodName in nunit #12590

Closed
SimonCropp opened this issue Aug 19, 2023 · 2 comments

Comments

@SimonCropp
Copy link
Contributor

[assembly: AvaloniaTestApplication(typeof(TestAppBuilder))]

public static class TestAppBuilder
{
    public static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure<App>()
        .UseSkia()
        .UseHeadless(new()
        {
            UseHeadlessDrawing = false
        });
}

public class CalculatorTests
{
    [AvaloniaTest]
    public void Should_Add_Numbers()
    {
        Assert.That(TestContext.CurrentContext.Test.MethodName, Is.EqualTo("Should_Add_Numbers"));
    }

    [AvaloniaTest]
    public void Cannot_Divide_By_Zero()
    {
        Assert.That(TestContext.CurrentContext.Test.MethodName, Is.EqualTo("Cannot_Divide_By_Zero"));
    }
}

result

Expected string length 18 but was 21. Strings differ at index 0.
  Expected: "Should_Add_Numbers"
  But was:  "Cannot_Divide_By_Zero"
  -----------^

   at TestableApp.Headless.NUnit.CalculatorTests.Should_Add_Numbers() in D:\Code\VerifyTests\Verify.Avalonia\src\NUnitTests\CalculatorTests.cs:line 13
@mpylon
Copy link
Contributor

mpylon commented Jul 26, 2024

@SimonCropp , @maxkatz6

This should be fixed by #16157

@SimonCropp
Copy link
Contributor Author

@mpylon thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants