From 23e530cede9c427f623ad3310297b03d181bc27e Mon Sep 17 00:00:00 2001 From: Sergey Vlasov Date: Wed, 30 Sep 2026 17:36:47 +0500 Subject: [PATCH 1/6] Updated projects for .NET 10 support. --- ExcelDna.Testing/Directory.Build.targets | 4 ++-- ExcelDna.Testing/ExampleAddinNET8/ExampleAddinNET8.csproj | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ExcelDna.Testing/Directory.Build.targets b/ExcelDna.Testing/Directory.Build.targets index 5ece0e3..3c8788e 100644 --- a/ExcelDna.Testing/Directory.Build.targets +++ b/ExcelDna.Testing/Directory.Build.targets @@ -1,7 +1,7 @@ - - + + diff --git a/ExcelDna.Testing/ExampleAddinNET8/ExampleAddinNET8.csproj b/ExcelDna.Testing/ExampleAddinNET8/ExampleAddinNET8.csproj index 7b92564..d6bcf20 100644 --- a/ExcelDna.Testing/ExampleAddinNET8/ExampleAddinNET8.csproj +++ b/ExcelDna.Testing/ExampleAddinNET8/ExampleAddinNET8.csproj @@ -2,6 +2,7 @@ net8.0-windows + LatestMajor enable enable From 82233abb28235873c7fc07ab010c37fa08a7a9cc Mon Sep 17 00:00:00 2001 From: Sergey Vlasov Date: Sat, 31 Oct 2026 17:37:04 +0500 Subject: [PATCH 2/6] Updated projects PackageReference to xunit.v3. --- ExcelDna.Testing/Examples/Examples.csproj | 5 +++-- ExcelDna.Testing/ExcelDna.Testing/ExcelDna.Testing.csproj | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ExcelDna.Testing/Examples/Examples.csproj b/ExcelDna.Testing/Examples/Examples.csproj index e197164..ff000d0 100644 --- a/ExcelDna.Testing/Examples/Examples.csproj +++ b/ExcelDna.Testing/Examples/Examples.csproj @@ -4,12 +4,13 @@ net472;net6.0-windows true true + Exe - + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -34,7 +35,7 @@ - + diff --git a/ExcelDna.Testing/ExcelDna.Testing/ExcelDna.Testing.csproj b/ExcelDna.Testing/ExcelDna.Testing/ExcelDna.Testing.csproj index 75e91e9..69fa166 100644 --- a/ExcelDna.Testing/ExcelDna.Testing/ExcelDna.Testing.csproj +++ b/ExcelDna.Testing/ExcelDna.Testing/ExcelDna.Testing.csproj @@ -12,7 +12,7 @@ - + \ No newline at end of file From f272077d33361c6c0c11fcb86e48e0b39676d594 Mon Sep 17 00:00:00 2001 From: Sergey Vlasov Date: Sun, 1 Nov 2026 12:04:40 +0500 Subject: [PATCH 3/6] Replaced Xunit.Abstractions with Xunit.v3. --- ExcelDna.Testing/ExcelDna.Testing/ExcelFactDiscoverer.cs | 2 +- .../ExcelDna.Testing/ExcelTestAssemblyRunner.cs | 3 +-- ExcelDna.Testing/ExcelDna.Testing/ExcelTestCase.cs | 3 +-- ExcelDna.Testing/ExcelDna.Testing/ExcelTestCaseRunner.cs | 2 +- ExcelDna.Testing/ExcelDna.Testing/ExcelTestFramework.cs | 4 +--- .../ExcelDna.Testing/ExcelTestFrameworkExecutor.cs | 2 +- ExcelDna.Testing/ExcelDna.Testing/ExcelTestRunner.cs | 4 +--- .../ExcelDna.Testing/Remote/BusMessageEventArgs.cs | 2 +- ExcelDna.Testing/ExcelDna.Testing/Remote/Converters.cs | 7 ++++--- .../ExcelDna.Testing/Remote/MessageBusProxy.cs | 4 ++-- .../ExcelDna.Testing/Remote/PlainMethodInfo.cs | 1 - .../ExcelDna.Testing/Remote/PlainTestFailed.cs | 2 +- ExcelDna.Testing/ExcelDna.Testing/Remote/RemoteExcel.cs | 2 +- .../ExcelDna.Testing/Remote/TestFrameworkOptions.cs | 2 +- .../ExcelDna.Testing/RemoteTestAssemblyRunner.cs | 3 +-- ExcelDna.Testing/ExcelDna.Testing/RunnerUtil.cs | 2 +- 16 files changed, 19 insertions(+), 26 deletions(-) diff --git a/ExcelDna.Testing/ExcelDna.Testing/ExcelFactDiscoverer.cs b/ExcelDna.Testing/ExcelDna.Testing/ExcelFactDiscoverer.cs index a7d24c9..f7418e0 100644 --- a/ExcelDna.Testing/ExcelDna.Testing/ExcelFactDiscoverer.cs +++ b/ExcelDna.Testing/ExcelDna.Testing/ExcelFactDiscoverer.cs @@ -1,8 +1,8 @@ using System.Collections.Generic; using Xunit; -using Xunit.Abstractions; using Xunit.Sdk; using System.Linq; +using Xunit.v3; namespace ExcelDna.Testing { diff --git a/ExcelDna.Testing/ExcelDna.Testing/ExcelTestAssemblyRunner.cs b/ExcelDna.Testing/ExcelDna.Testing/ExcelTestAssemblyRunner.cs index 6cf44e0..7312694 100644 --- a/ExcelDna.Testing/ExcelDna.Testing/ExcelTestAssemblyRunner.cs +++ b/ExcelDna.Testing/ExcelDna.Testing/ExcelTestAssemblyRunner.cs @@ -8,9 +8,8 @@ using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; -using Xunit; -using Xunit.Abstractions; using Xunit.Sdk; +using Xunit.v3; namespace ExcelDna.Testing { diff --git a/ExcelDna.Testing/ExcelDna.Testing/ExcelTestCase.cs b/ExcelDna.Testing/ExcelDna.Testing/ExcelTestCase.cs index 98b004d..d7e0ce1 100644 --- a/ExcelDna.Testing/ExcelDna.Testing/ExcelTestCase.cs +++ b/ExcelDna.Testing/ExcelDna.Testing/ExcelTestCase.cs @@ -1,10 +1,9 @@ using System; -using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; -using Xunit.Abstractions; using Xunit.Internal; using Xunit.Sdk; +using Xunit.v3; namespace ExcelDna.Testing { diff --git a/ExcelDna.Testing/ExcelDna.Testing/ExcelTestCaseRunner.cs b/ExcelDna.Testing/ExcelDna.Testing/ExcelTestCaseRunner.cs index 35806e4..f1819fe 100644 --- a/ExcelDna.Testing/ExcelDna.Testing/ExcelTestCaseRunner.cs +++ b/ExcelDna.Testing/ExcelDna.Testing/ExcelTestCaseRunner.cs @@ -2,8 +2,8 @@ using System.Collections.Generic; using System.Reflection; using System.Threading; -using Xunit.Abstractions; using Xunit.Sdk; +using Xunit.v3; namespace ExcelDna.Testing { diff --git a/ExcelDna.Testing/ExcelDna.Testing/ExcelTestFramework.cs b/ExcelDna.Testing/ExcelDna.Testing/ExcelTestFramework.cs index 6c50b44..ad2a866 100644 --- a/ExcelDna.Testing/ExcelDna.Testing/ExcelTestFramework.cs +++ b/ExcelDna.Testing/ExcelDna.Testing/ExcelTestFramework.cs @@ -1,9 +1,7 @@ using System.Reflection; -using Xunit.Abstractions; using Xunit.Sdk; using ExcelDna.Testing; - - +using Xunit.v3; namespace Xunit { diff --git a/ExcelDna.Testing/ExcelDna.Testing/ExcelTestFrameworkExecutor.cs b/ExcelDna.Testing/ExcelDna.Testing/ExcelTestFrameworkExecutor.cs index 65f7af6..d7ad386 100644 --- a/ExcelDna.Testing/ExcelDna.Testing/ExcelTestFrameworkExecutor.cs +++ b/ExcelDna.Testing/ExcelDna.Testing/ExcelTestFrameworkExecutor.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Reflection; -using Xunit.Abstractions; using Xunit.Sdk; +using Xunit.v3; namespace ExcelDna.Testing { diff --git a/ExcelDna.Testing/ExcelDna.Testing/ExcelTestRunner.cs b/ExcelDna.Testing/ExcelDna.Testing/ExcelTestRunner.cs index b7f396e..9b76951 100644 --- a/ExcelDna.Testing/ExcelDna.Testing/ExcelTestRunner.cs +++ b/ExcelDna.Testing/ExcelDna.Testing/ExcelTestRunner.cs @@ -5,10 +5,8 @@ using System.Reflection; using System.Threading; using System.Threading.Tasks; -using System.Windows; -using System.Windows.Threading; -using Xunit.Abstractions; using Xunit.Sdk; +using Xunit.v3; namespace ExcelDna.Testing { diff --git a/ExcelDna.Testing/ExcelDna.Testing/Remote/BusMessageEventArgs.cs b/ExcelDna.Testing/ExcelDna.Testing/Remote/BusMessageEventArgs.cs index 0f5c641..b932935 100644 --- a/ExcelDna.Testing/ExcelDna.Testing/Remote/BusMessageEventArgs.cs +++ b/ExcelDna.Testing/ExcelDna.Testing/Remote/BusMessageEventArgs.cs @@ -1,6 +1,6 @@ using System; -using Xunit.Abstractions; using Xunit.Sdk; +using Xunit.v3; namespace ExcelDna.Testing.Remote { diff --git a/ExcelDna.Testing/ExcelDna.Testing/Remote/Converters.cs b/ExcelDna.Testing/ExcelDna.Testing/Remote/Converters.cs index 37aa66f..2f7db6a 100644 --- a/ExcelDna.Testing/ExcelDna.Testing/Remote/Converters.cs +++ b/ExcelDna.Testing/ExcelDna.Testing/Remote/Converters.cs @@ -1,5 +1,6 @@ using Newtonsoft.Json; using System; +using Xunit.Sdk; namespace ExcelDna.Testing.Remote { @@ -42,7 +43,7 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist public override bool CanConvert(Type objectType) { - return objectType == typeof(Xunit.Abstractions.ITestCase) || objectType == typeof(Xunit.Sdk.IXunitTestCase); + return objectType == typeof(ITestCase) || objectType == typeof(Xunit.Sdk.IXunitTestCase); } } @@ -65,7 +66,7 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist public override bool CanConvert(Type objectType) { - return objectType == typeof(Xunit.Abstractions.IAssemblyInfo) || objectType == typeof(Xunit.Sdk.ReflectionAssemblyInfo); + return objectType == typeof(IAssemblyInfo) || objectType == typeof(Xunit.Sdk.ReflectionAssemblyInfo); } } @@ -88,7 +89,7 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist public override bool CanConvert(Type objectType) { - return objectType == typeof(Xunit.Sdk.ReflectionTypeInfo) || objectType == typeof(Xunit.Abstractions.ITypeInfo); + return objectType == typeof(Xunit.Sdk.ReflectionTypeInfo) || objectType == typeof(ITypeInfo); } } } diff --git a/ExcelDna.Testing/ExcelDna.Testing/Remote/MessageBusProxy.cs b/ExcelDna.Testing/ExcelDna.Testing/Remote/MessageBusProxy.cs index 37f12f5..743f30c 100644 --- a/ExcelDna.Testing/ExcelDna.Testing/Remote/MessageBusProxy.cs +++ b/ExcelDna.Testing/ExcelDna.Testing/Remote/MessageBusProxy.cs @@ -1,5 +1,5 @@ -using Xunit.Abstractions; -using Xunit.Sdk; +using Xunit.Sdk; +using Xunit.v3; namespace ExcelDna.Testing.Remote { diff --git a/ExcelDna.Testing/ExcelDna.Testing/Remote/PlainMethodInfo.cs b/ExcelDna.Testing/ExcelDna.Testing/Remote/PlainMethodInfo.cs index e0d9903..7ca2f3e 100644 --- a/ExcelDna.Testing/ExcelDna.Testing/Remote/PlainMethodInfo.cs +++ b/ExcelDna.Testing/ExcelDna.Testing/Remote/PlainMethodInfo.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using Xunit.Abstractions; namespace ExcelDna.Testing.Remote { diff --git a/ExcelDna.Testing/ExcelDna.Testing/Remote/PlainTestFailed.cs b/ExcelDna.Testing/ExcelDna.Testing/Remote/PlainTestFailed.cs index efd629d..c5a1c86 100644 --- a/ExcelDna.Testing/ExcelDna.Testing/Remote/PlainTestFailed.cs +++ b/ExcelDna.Testing/ExcelDna.Testing/Remote/PlainTestFailed.cs @@ -1,4 +1,4 @@ -using Xunit.Abstractions; +using Xunit.Sdk; namespace ExcelDna.Testing.Remote { diff --git a/ExcelDna.Testing/ExcelDna.Testing/Remote/RemoteExcel.cs b/ExcelDna.Testing/ExcelDna.Testing/Remote/RemoteExcel.cs index 785132a..c59161c 100644 --- a/ExcelDna.Testing/ExcelDna.Testing/Remote/RemoteExcel.cs +++ b/ExcelDna.Testing/ExcelDna.Testing/Remote/RemoteExcel.cs @@ -44,7 +44,7 @@ public async Task CloseHostAsync() } #pragma warning restore CS1998 - private bool SendBusMessage(Xunit.Abstractions.IMessageSinkMessage message) + private bool SendBusMessage(IMessageSinkMessage message) { if (BusMessage == null) return false; diff --git a/ExcelDna.Testing/ExcelDna.Testing/Remote/TestFrameworkOptions.cs b/ExcelDna.Testing/ExcelDna.Testing/Remote/TestFrameworkOptions.cs index abdb801..f9a5791 100644 --- a/ExcelDna.Testing/ExcelDna.Testing/Remote/TestFrameworkOptions.cs +++ b/ExcelDna.Testing/ExcelDna.Testing/Remote/TestFrameworkOptions.cs @@ -1,5 +1,5 @@ using System.Collections.Generic; -using Xunit.Abstractions; +using Xunit.Sdk; namespace ExcelDna.Testing.Remote { diff --git a/ExcelDna.Testing/ExcelDna.Testing/RemoteTestAssemblyRunner.cs b/ExcelDna.Testing/ExcelDna.Testing/RemoteTestAssemblyRunner.cs index 29c6803..1a83586 100644 --- a/ExcelDna.Testing/ExcelDna.Testing/RemoteTestAssemblyRunner.cs +++ b/ExcelDna.Testing/ExcelDna.Testing/RemoteTestAssemblyRunner.cs @@ -4,9 +4,8 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; -using Xunit; -using Xunit.Abstractions; using Xunit.Sdk; +using Xunit.v3; namespace ExcelDna.Testing { diff --git a/ExcelDna.Testing/ExcelDna.Testing/RunnerUtil.cs b/ExcelDna.Testing/ExcelDna.Testing/RunnerUtil.cs index cdc39c7..c87e834 100644 --- a/ExcelDna.Testing/ExcelDna.Testing/RunnerUtil.cs +++ b/ExcelDna.Testing/ExcelDna.Testing/RunnerUtil.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using Xunit.Abstractions; +using Xunit.Sdk; namespace ExcelDna.Testing { From 887e46c44425a726acda5f588bd800e867276c2a Mon Sep 17 00:00:00 2001 From: Sergey Vlasov Date: Sun, 1 Nov 2026 12:06:20 +0500 Subject: [PATCH 4/6] Updated Xunit attributes. --- ExcelDna.Testing/ExcelDna.Testing/ExcelFactAttribute.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ExcelDna.Testing/ExcelDna.Testing/ExcelFactAttribute.cs b/ExcelDna.Testing/ExcelDna.Testing/ExcelFactAttribute.cs index 9f79b7b..4a9cae3 100644 --- a/ExcelDna.Testing/ExcelDna.Testing/ExcelFactAttribute.cs +++ b/ExcelDna.Testing/ExcelDna.Testing/ExcelFactAttribute.cs @@ -1,11 +1,11 @@ using System; -using Xunit.Sdk; using ExcelDna.Testing; +using Xunit.v3; namespace Xunit { [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] - [XunitTestCaseDiscoverer("ExcelDna.Testing." + nameof(ExcelFactDiscoverer), "ExcelDna.Testing")] + [XunitTestCaseDiscoverer(typeof(ExcelFactDiscoverer))] public class ExcelFactAttribute : FactAttribute, ITestSettings { /// From 4d51ada0f06683bda85496614dcd16f7382d9379 Mon Sep 17 00:00:00 2001 From: Sergey Vlasov Date: Sun, 1 Nov 2026 13:16:25 +0500 Subject: [PATCH 5/6] Updated the Discoverer. --- .../ExcelDna.Testing/ExcelDna.Testing.csproj | 1 + .../ExcelDna.Testing/ExcelFactDiscoverer.cs | 54 +++++++------------ .../ExcelDna.Testing/ExcelTestCase.cs | 4 +- 3 files changed, 23 insertions(+), 36 deletions(-) diff --git a/ExcelDna.Testing/ExcelDna.Testing/ExcelDna.Testing.csproj b/ExcelDna.Testing/ExcelDna.Testing/ExcelDna.Testing.csproj index 69fa166..bb1618e 100644 --- a/ExcelDna.Testing/ExcelDna.Testing/ExcelDna.Testing.csproj +++ b/ExcelDna.Testing/ExcelDna.Testing/ExcelDna.Testing.csproj @@ -2,6 +2,7 @@ net472;net6.0-windows + 9.0 true true diff --git a/ExcelDna.Testing/ExcelDna.Testing/ExcelFactDiscoverer.cs b/ExcelDna.Testing/ExcelDna.Testing/ExcelFactDiscoverer.cs index f7418e0..37b43fd 100644 --- a/ExcelDna.Testing/ExcelDna.Testing/ExcelFactDiscoverer.cs +++ b/ExcelDna.Testing/ExcelDna.Testing/ExcelFactDiscoverer.cs @@ -1,54 +1,40 @@ using System.Collections.Generic; using Xunit; using Xunit.Sdk; -using System.Linq; using Xunit.v3; +using System.Threading.Tasks; +using System.Reflection; namespace ExcelDna.Testing { class ExcelFactDiscoverer : FactDiscoverer { - public ExcelFactDiscoverer(IMessageSink diagnosticMessageSink) : base(diagnosticMessageSink) + public ExcelFactDiscoverer(IMessageSink diagnosticMessageSink) { } - public override IEnumerable Discover(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo factAttribute) + public override ValueTask> Discover(ITestFrameworkDiscoveryOptions discoveryOptions, IXunitTestMethod testMethod, IFactAttribute factAttribute) { var results = new List(); - results.Add(new ExcelTestCase(GetSettings(testMethod), DiagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), testMethod, null)); - return results; + results.Add(new ExcelTestCase(GetSettings(testMethod), discoveryOptions.MethodDisplayOrDefault(), testMethod, null)); + return new(results); } - private static ExcelTestSettings GetSettings(ITestMethod testMethod) + private static ExcelTestSettings GetSettings(IXunitTestMethod testMethod) { - return new ExcelTestSettings( - GetSetting(testMethod, nameof(ExcelFactAttribute.OutOfProcess)), - GetSetting(testMethod, nameof(ExcelFactAttribute.Workbook)), - GetSetting(testMethod, nameof(ExcelFactAttribute.AddIn))); - } - - private static T GetSetting(ITestMethod testMethod, string name) - { - object arg = GetNamedArg(testMethod.Method.GetCustomAttributes(typeof(ExcelFactAttribute)).FirstOrDefault(), name); - if (arg == null) - arg = GetNamedArg(testMethod.TestClass.Class.GetCustomAttributes(typeof(ExcelTestSettingsAttribute)).FirstOrDefault(), name); - - return arg is T ? (T)arg : default(T); - } - - private static object GetNamedArg(IAttributeInfo attributeInfo, string argumentName) - { - if (!IsNamedArg(attributeInfo, argumentName)) - return null; - - return attributeInfo.GetNamedArgument(argumentName); - } - - private static bool IsNamedArg(IAttributeInfo attributeInfo, string argumentName) - { - if (attributeInfo is ReflectionAttributeInfo reflectionAttributeInfo) - return reflectionAttributeInfo.AttributeData.NamedArguments.Any(arg => arg.MemberName == argumentName); - return false; + { + ExcelFactAttribute attr = testMethod.Method.GetCustomAttribute(); + if (attr != null) + return new ExcelTestSettings(attr.OutOfProcess, attr.Workbook, attr.AddIn); + } + { + ExcelTestSettingsAttribute attr = testMethod.Method.GetCustomAttribute(); + if (attr != null) + return new ExcelTestSettings(attr.OutOfProcess, attr.Workbook, attr.AddIn); + } + + + return new ExcelTestSettings(false, null, null); } } } diff --git a/ExcelDna.Testing/ExcelDna.Testing/ExcelTestCase.cs b/ExcelDna.Testing/ExcelDna.Testing/ExcelTestCase.cs index d7e0ce1..8cfa15c 100644 --- a/ExcelDna.Testing/ExcelDna.Testing/ExcelTestCase.cs +++ b/ExcelDna.Testing/ExcelDna.Testing/ExcelTestCase.cs @@ -16,8 +16,8 @@ public ExcelTestCase() } #pragma warning disable CS0618 - public ExcelTestCase(ExcelTestSettings testSettings, IMessageSink diagnosticMessageSink, TestMethodDisplay defaultMethodDisplay, ITestMethod testMethod, object[] testMethodArguments = null) - : base(diagnosticMessageSink, defaultMethodDisplay, testMethod, testMethodArguments) + public ExcelTestCase(ExcelTestSettings testSettings, TestMethodDisplay defaultMethodDisplay, ITestMethod testMethod, object[] testMethodArguments = null) + : base(defaultMethodDisplay, testMethod, testMethodArguments) { this.testSettings = testSettings; } From 983346888447ae3f69fa8492efb3b335d620372b Mon Sep 17 00:00:00 2001 From: Sergey Vlasov Date: Sun, 1 Nov 2026 21:33:10 +0500 Subject: [PATCH 6/6] Implemented ISelfExecutingXunitTestCase. --- .../ExcelDna.Testing/ExcelFactDiscoverer.cs | 23 ++++++++++++--- .../ExcelDna.Testing/ExcelTestCase.cs | 29 +++++++++++++++---- 2 files changed, 43 insertions(+), 9 deletions(-) diff --git a/ExcelDna.Testing/ExcelDna.Testing/ExcelFactDiscoverer.cs b/ExcelDna.Testing/ExcelDna.Testing/ExcelFactDiscoverer.cs index 37b43fd..ae92d46 100644 --- a/ExcelDna.Testing/ExcelDna.Testing/ExcelFactDiscoverer.cs +++ b/ExcelDna.Testing/ExcelDna.Testing/ExcelFactDiscoverer.cs @@ -4,6 +4,8 @@ using Xunit.v3; using System.Threading.Tasks; using System.Reflection; +using System; +using Xunit.Internal; namespace ExcelDna.Testing { @@ -15,9 +17,23 @@ public ExcelFactDiscoverer(IMessageSink diagnosticMessageSink) public override ValueTask> Discover(ITestFrameworkDiscoveryOptions discoveryOptions, IXunitTestMethod testMethod, IFactAttribute factAttribute) { - var results = new List(); - results.Add(new ExcelTestCase(GetSettings(testMethod), discoveryOptions.MethodDisplayOrDefault(), testMethod, null)); - return new(results); + var details = TestIntrospectionHelper.GetTestCaseDetails(discoveryOptions, testMethod, factAttribute); + IXunitTestCase testCase = new ExcelTestCase(GetSettings(testMethod), + details.ResolvedTestMethod, + details.TestCaseDisplayName, + details.UniqueID, + details.Explicit, + details.SkipExceptions, + details.SkipReason, + details.SkipType, + details.SkipUnless, + details.SkipWhen, + testMethod.Traits.ToReadWrite(StringComparer.OrdinalIgnoreCase), + sourceFilePath: details.SourceFilePath, + sourceLineNumber: details.SourceLineNumber, + timeout: details.Timeout); + + return new(new IXunitTestCase[] { testCase }); } private static ExcelTestSettings GetSettings(IXunitTestMethod testMethod) @@ -33,7 +49,6 @@ private static ExcelTestSettings GetSettings(IXunitTestMethod testMethod) return new ExcelTestSettings(attr.OutOfProcess, attr.Workbook, attr.AddIn); } - return new ExcelTestSettings(false, null, null); } } diff --git a/ExcelDna.Testing/ExcelDna.Testing/ExcelTestCase.cs b/ExcelDna.Testing/ExcelDna.Testing/ExcelTestCase.cs index 8cfa15c..9db4c55 100644 --- a/ExcelDna.Testing/ExcelDna.Testing/ExcelTestCase.cs +++ b/ExcelDna.Testing/ExcelDna.Testing/ExcelTestCase.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Xunit.Internal; @@ -8,7 +9,7 @@ namespace ExcelDna.Testing { [Newtonsoft.Json.JsonConverter(typeof(Remote.ExcelTestCaseConverter))] - public class ExcelTestCase : XunitTestCase + public class ExcelTestCase : XunitTestCase, ISelfExecutingXunitTestCase { [Obsolete("Called by the de-serializer; should only be called by deriving classes for de-serialization purposes")] public ExcelTestCase() @@ -16,8 +17,24 @@ public ExcelTestCase() } #pragma warning disable CS0618 - public ExcelTestCase(ExcelTestSettings testSettings, TestMethodDisplay defaultMethodDisplay, ITestMethod testMethod, object[] testMethodArguments = null) - : base(defaultMethodDisplay, testMethod, testMethodArguments) + public ExcelTestCase(ExcelTestSettings testSettings, + IXunitTestMethod testMethod, + string testCaseDisplayName, + string uniqueID, + bool @explicit, + Type[]? skipExceptions = null, + string? skipReason = null, + Type? skipType = null, + string? skipUnless = null, + string? skipWhen = null, + Dictionary>? traits = null, + object?[]? testMethodArguments = null, + string? sourceFilePath = null, + int? sourceLineNumber = null, + int? timeout = null) + : base(testMethod, testCaseDisplayName, uniqueID, @explicit, skipExceptions, skipReason, + skipType, skipUnless, skipWhen, traits, testMethodArguments, sourceFilePath, + sourceLineNumber, timeout) { this.testSettings = testSettings; } @@ -25,8 +42,10 @@ public ExcelTestCase(ExcelTestSettings testSettings, TestMethodDisplay defaultMe public ExcelTestSettings Settings => testSettings; - public override Task RunAsync(IMessageSink diagnosticMessageSink, IMessageBus messageBus, object[] constructorArguments, ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource) - => new ExcelTestCaseRunner(this, DisplayName, SkipReason, constructorArguments, TestMethodArguments, messageBus, aggregator, cancellationTokenSource).RunAsync(); + public ValueTask Run(ExplicitOption explicitOption, IMessageBus messageBus, object[] constructorArguments, ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource, ParallelMode parallelMode, ExecutionScheduler scheduler, FixtureMappingManager methodFixtureMappings) + { + return new ExcelTestCaseRunner(this, TestCaseDisplayName, SkipReason, constructorArguments, TestMethodArguments, messageBus, aggregator, cancellationTokenSource).RunAsync(); + } public override void Serialize(IXunitSerializationInfo info) {