diff --git a/packages/csharp/src/AlphaTab.Test/AlphaTab.Test.csproj b/packages/csharp/src/AlphaTab.Test/AlphaTab.Test.csproj index dfe12aebec..4c44d396c5 100644 --- a/packages/csharp/src/AlphaTab.Test/AlphaTab.Test.csproj +++ b/packages/csharp/src/AlphaTab.Test/AlphaTab.Test.csproj @@ -12,8 +12,8 @@ - - + + diff --git a/packages/csharp/src/AlphaTab.Test/Test/Globals.cs b/packages/csharp/src/AlphaTab.Test/Test/Globals.cs index 06968ea81a..111267de4f 100644 --- a/packages/csharp/src/AlphaTab.Test/Test/Globals.cs +++ b/packages/csharp/src/AlphaTab.Test/Test/Globals.cs @@ -36,7 +36,7 @@ public static Expector Expect(Action actual) public static void Fail(object? message) { - Assert.Fail(Convert.ToString(message)); + Assert.Fail(Convert.ToString(message) ?? string.Empty); } private static readonly Dictionary SnapshotAssertionCounters = new(); diff --git a/packages/csharp/src/AlphaTab.Test/TestClassAttribute.cs b/packages/csharp/src/AlphaTab.Test/TestClassAttribute.cs index 277cd77b33..a7b397eab2 100644 --- a/packages/csharp/src/AlphaTab.Test/TestClassAttribute.cs +++ b/packages/csharp/src/AlphaTab.Test/TestClassAttribute.cs @@ -1,5 +1,7 @@ using System; +using System.Runtime.CompilerServices; using System.Threading; +using System.Threading.Tasks; using Microsoft.VisualStudio.TestTools.UnitTesting; // ReSharper disable once CheckNamespace @@ -18,14 +20,19 @@ public TestClassAttribute(string displayName) public class TestMethodAttribute : Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute { - public TestMethodAttribute(string displayName) : base(displayName) + public TestMethodAttribute( + string displayName, + [CallerFilePath] string callerFilePath = "", + [CallerLineNumber] int callerLineNumber = -1 + ) : base(callerFilePath, callerLineNumber) { + DisplayName = displayName; } - public override TestResult[] Execute(ITestMethod testMethod) + public override async Task ExecuteAsync(ITestMethod testMethod) { TestMethodAccessor.CurrentTest = testMethod; - var result = base.Execute(testMethod); + var result = await base.ExecuteAsync(testMethod); TestMethodAccessor.CurrentTest = null; return result; }