diff --git a/src/Verify.NUnit/Extensions.cs b/src/Verify.NUnit/Extensions.cs index 4f0ba8927d..e6054fb5cc 100644 --- a/src/Verify.NUnit/Extensions.cs +++ b/src/Verify.NUnit/Extensions.cs @@ -13,8 +13,7 @@ public static IMethodInfo GetTestMethod(this TestAdapter adapter) public static bool TryGetParent(this TestAdapter adapter, [NotNullWhen(true)] out ITest? parent) { - var test = adapter.GetTest(); - parent = test.Parent; + parent = adapter.Parent; if (parent is ParameterizedMethodSuite methodSuite) { parent = methodSuite.Parent; @@ -23,12 +22,6 @@ public static bool TryGetParent(this TestAdapter adapter, [NotNullWhen(true)] ou return parent != null; } - static FieldInfo testField = typeof(TestAdapter) - .GetField("_test", BindingFlags.Instance | BindingFlags.NonPublic)!; - - public static Test GetTest(this TestAdapter adapter) => - (Test) testField.GetValue(adapter)!; - public static IReadOnlyList? GetParameterNames(this TestAdapter adapter) { var method = adapter.Method!;