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
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..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
@@ -12,7 +13,7 @@
-
+
\ No newline at end of file
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
{
///
diff --git a/ExcelDna.Testing/ExcelDna.Testing/ExcelFactDiscoverer.cs b/ExcelDna.Testing/ExcelDna.Testing/ExcelFactDiscoverer.cs
index a7d24c9..ae92d46 100644
--- a/ExcelDna.Testing/ExcelDna.Testing/ExcelFactDiscoverer.cs
+++ b/ExcelDna.Testing/ExcelDna.Testing/ExcelFactDiscoverer.cs
@@ -1,54 +1,55 @@
using System.Collections.Generic;
using Xunit;
-using Xunit.Abstractions;
using Xunit.Sdk;
-using System.Linq;
+using Xunit.v3;
+using System.Threading.Tasks;
+using System.Reflection;
+using System;
+using Xunit.Internal;
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;
+ 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(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