diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props
index 35865a31f..732f9805f 100644
--- a/src/Directory.Packages.props
+++ b/src/Directory.Packages.props
@@ -31,8 +31,8 @@
-
-
+
+
diff --git a/src/Verify.TUnit/TUnitExtensions.cs b/src/Verify.TUnit/TUnitExtensions.cs
index 3d259f44b..f2824897c 100644
--- a/src/Verify.TUnit/TUnitExtensions.cs
+++ b/src/Verify.TUnit/TUnitExtensions.cs
@@ -2,10 +2,10 @@ static class TUnitExtensions
{
public static IReadOnlyList? GetParameterNames(this TestDetails details)
{
- var methodParameterNames = details.MethodInfo.ParameterNames();
+ var methodParameterNames = details.TestMethod.Parameters.Select(x => x.Name).ToList();
var constructorParameterNames = GetConstructorParameterNames(details);
- if (methodParameterNames == null)
+ if (methodParameterNames.Count is 0)
{
if (constructorParameterNames.Count == 0)
{
@@ -26,12 +26,13 @@ static class TUnitExtensions
static List GetConstructorParameterNames(TestDetails details)
{
- var constructors = details.ClassType.GetConstructors(BindingFlags.Instance | BindingFlags.Public);
- if (constructors.Length <= 1)
+ var parameters = details.TestClass.Parameters;
+ if (parameters.Length is 0)
{
- return constructors[0].GetParameters().Select(_ => _.Name!).ToList();
+ return [];
}
- throw new("Found multiple constructors. Unable to derive names of parameters. Instead use UseParameters to pass in explicit parameter.");
+ return parameters.Select(_ => _.Name).ToList();
+
}
}
\ No newline at end of file
diff --git a/src/Verify.TUnit/Verifier.cs b/src/Verify.TUnit/Verifier.cs
index dfcf828c5..0b89b1eb5 100644
--- a/src/Verify.TUnit/Verifier.cs
+++ b/src/Verify.TUnit/Verifier.cs
@@ -30,7 +30,7 @@ static InnerVerifier BuildVerifier(string sourceFile, VerifySettings settings, b
}
var details = TestContext.Current!.TestDetails;
- var type = details.ClassType;
+ var type = details.TestClass.Type;
var classArguments = details.TestClassArguments;
var methodArguments = details.TestMethodArguments;
if (!settings.HasParameters &&
@@ -42,8 +42,8 @@ static InnerVerifier BuildVerifier(string sourceFile, VerifySettings settings, b
VerifierSettings.AssignTargetAssembly(type.Assembly);
- var method = details.MethodInfo;
- var pathInfo = GetPathInfo(sourceFile, type, method);
+ var method = details.TestMethod;
+ var pathInfo = GetPathInfo(sourceFile, type, method.ReflectionInformation);
return new(
sourceFile,
settings,
diff --git a/src/Verify.TUnit/VerifyChecks.cs b/src/Verify.TUnit/VerifyChecks.cs
index 88f8acc06..343e908e8 100644
--- a/src/Verify.TUnit/VerifyChecks.cs
+++ b/src/Verify.TUnit/VerifyChecks.cs
@@ -6,7 +6,7 @@ public static class VerifyChecks
public static Task Run()
{
var details = TestContext.Current!.TestDetails;
- var type = details.ClassType;
+ var type = details.TestClass.Type;
VerifierSettings.AssignTargetAssembly(type.Assembly);
return InnerVerifyChecks.Run(type.Assembly);
}