[AvaloniaTest] results in incorrect TestContext.CurrentContext.Test.MethodName in nunit
SimonCropp opened this issue · comments
Simon Cropp commented
[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
Simon Cropp commented
@mpylon thanks