From b843c84482c7d957e3d9a0cdbd662ef84c6500e1 Mon Sep 17 00:00:00 2001 From: Tom Longhurst <30480171+thomhurst@users.noreply.github.com> Date: Sun, 5 Oct 2025 19:48:22 +0100 Subject: [PATCH 1/2] Refactor test invoker generation in source generator --- .../AbstractTests.Concrete1.verified.txt | 5 - .../AbstractTests.Concrete2.verified.txt | 22 -- .../AfterAllTests.Test.verified.txt | 10 - .../AfterTests.Test.verified.txt | 10 - .../ArgsAsArrayTests.Test.verified.txt | 101 ------- ...thImplicitConverterTests.Test.verified.txt | 26 -- ...blyLoaderTests.Test.DotNet8_0.verified.txt | 16 -- ...blyLoaderTests.Test.DotNet9_0.verified.txt | 16 -- ...semblyLoaderTests.Test.Net4_7.verified.txt | 16 -- ...hodDataSourceDrivenTests.Test.verified.txt | 84 ------ .../AttributeTests.Test.verified.txt | 6 - .../BasicTests.Test.DotNet8_0.verified.txt | 16 -- .../BasicTests.Test.DotNet9_0.verified.txt | 16 -- .../BasicTests.Test.Net4_7.verified.txt | 16 -- .../BeforeAllTests.Test.verified.txt | 10 - .../BeforeTests.Test.verified.txt | 10 - ...llableTypeTest.Test.DotNet8_0.verified.txt | 6 - ...llableTypeTest.Test.DotNet9_0.verified.txt | 6 - ...1NullableTypeTest.Test.Net4_7.verified.txt | 6 - ...sAndMethodArgumentsTests.Test.verified.txt | 29 -- .../ClassConstructorTest.Test.verified.txt | 6 - ...assDataSourceDrivenTests.Test.verified.txt | 86 ------ ...ssDataSourceDrivenTests2.Test.verified.txt | 12 - ...ceDrivenTestsSharedKeyed.Test.verified.txt | 26 -- ...pleDataSourceDrivenTests.Test.verified.txt | 13 - .../ConcreteClassTests.Test.verified.txt | 22 -- .../ConstantArgumentsTests.Test.verified.txt | 84 ------ ...ConstantInBaseClassTests.Test.verified.txt | 12 - ...InterpolatedStringsTests.Test.verified.txt | 12 - .../CustomDisplayNameTests.Test.verified.txt | 73 ----- .../DataDrivenTests.Test.verified.txt | 130 --------- ...ithDataSourceMethodTests.Test.verified.txt | 13 - ...ataSourceGeneratorTests.Typed.verified.txt | 39 --- ...aSourceGeneratorTests.Untyped.verified.txt | 12 - ...onScannerTests.Test.DotNet8_0.verified.txt | 16 -- ...onScannerTests.Test.DotNet9_0.verified.txt | 16 -- ...ctionScannerTests.Test.Net4_7.verified.txt | 16 -- .../EnumMemberNamesTests.Test.verified.txt | 13 - ...bleDataSourceDrivenTests.Test.verified.txt | 37 --- ...pleDataSourceDrivenTests.Test.verified.txt | 13 - ...xpectedArgumentTypeTests.Test.verified.txt | 24 -- .../GenericMethodTests.Test.verified.txt | 35 --- ...cRegistry_WhenNoGenericsFound.verified.txt | 6 - ...Constraints_WithInstantiation.verified.txt | 13 - ...ass_WithExplicitInstantiation.verified.txt | 13 - ...hod_WithExplicitInstantiation.verified.txt | 35 --- ...est_MultipleGenericParameters.verified.txt | 13 - ...Tests.Test_NestedGenericTypes.verified.txt | 13 - .../Hooks1589.Test.verified.txt | 5 - .../Hooks1594.Test.verified.txt | 6 - ...ritedPropertySetterTests.Test.verified.txt | 10 - ...romDifferentProjectTests.Test.verified.txt | 86 ------ ...heritsTestsAbstractTests.Test.verified.txt | 22 -- .../InheritsTestsTests.Test.verified.txt | 48 ---- .../Issue2887Tests.Test.verified.txt | 6 - .../MatrixTests.Test.verified.txt | 144 ---------- ...hodDataSourceDrivenTests.Test.verified.txt | 90 ------- ...thCancellationTokenTests.Test.verified.txt | 14 - ...assDataSourceDrivenTests.Test.verified.txt | 12 - .../NameOfArgumentTests.Test.verified.txt | 12 - ...ullableByteArgumentTests.Test.verified.txt | 26 -- .../NumberArgumentTests.Test.verified.txt | 78 ------ .../NumberArgumentTests.TestDE.verified.txt | 78 ------ .../PriorityFilteringTests.Test.verified.txt | 30 --- .../PropertySetterTests.Test.verified.txt | 5 - .../RepeatTests.Test.verified.txt | 18 -- ...STAThreadTests.Test.DotNet8_0.verified.txt | 65 ----- ...STAThreadTests.Test.DotNet9_0.verified.txt | 65 ----- .../STAThreadTests.Test.Net4_7.verified.txt | 65 ----- .../StringArgumentTests.Test.verified.txt | 26 -- .../Tests.Test.verified.txt | 37 --- .../Tests1538.Test.verified.txt | 26 -- .../Tests1539.Test.verified.txt | 6 - .../Tests1589.Test.verified.txt | 5 - .../Tests1594.Test.verified.txt | 6 - .../Tests1603.Test.verified.txt | 24 -- .../Tests1692.Test.verified.txt | 12 - .../Tests1821.Test.verified.txt | 24 -- .../Tests1889.Test.DotNet8_0.verified.txt | 32 --- .../Tests1889.Test.DotNet9_0.verified.txt | 32 --- .../Tests1889.Test.Net4_7.verified.txt | 32 --- .../Tests1899.Test.verified.txt | 6 - .../Tests2083.Test.verified.txt | 13 - .../Tests2085.Test.verified.txt | 24 -- .../Tests2112.Test.verified.txt | 62 ----- .../Tests2136.Test.verified.txt | 39 --- ...utCancellationTokenTests.Test.verified.txt | 57 ---- ...pleDataSourceDrivenTests.Test.verified.txt | 13 - ...st_AotSafeDataSourceFactories.verified.txt | 13 - ...sts.Test_ConfigurationSupport.verified.txt | 6 - ..._ModuleInitializer_Generation.verified.txt | 6 - ...nglyTypedDelegates_Generation.verified.txt | 6 - .../Generators/TestMetadataGenerator.cs | 250 +----------------- 93 files changed, 3 insertions(+), 2869 deletions(-) diff --git a/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete1.verified.txt b/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete1.verified.txt index f7d1207d05..9e144497f2 100644 --- a/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete1.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete1.verified.txt @@ -56,11 +56,6 @@ internal sealed class ConcreteClass1_AssertClassName_TestSource_GUID : global::T }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.AbstractTests.ConcreteClass1(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.AbstractTests.ConcreteClass1)instance; - await typedInstance.AssertClassName(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.AssertClassName(); diff --git a/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete2.verified.txt b/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete2.verified.txt index 7e9528a128..1da5f79842 100644 --- a/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete2.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete2.verified.txt @@ -57,12 +57,6 @@ internal sealed class ConcreteClass2_SecondTest_TestSource_GUID : global::TUnit. }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.AbstractTests.ConcreteClass2(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.AbstractTests.ConcreteClass2)instance; - typedInstance.SecondTest(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.SecondTest(); @@ -145,11 +139,6 @@ internal sealed class ConcreteClass2_AssertClassName_TestSource_GUID : global::T }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.AbstractTests.ConcreteClass2(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.AbstractTests.ConcreteClass2)instance; - await typedInstance.AssertClassName(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.AssertClassName(); @@ -231,12 +220,6 @@ internal sealed class ConcreteClass2_SecondTest_TestSource_GUID : global::TUnit. }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.AbstractTests.ConcreteClass2(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.AbstractTests.ConcreteClass2)instance; - typedInstance.SecondTest(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.SecondTest(); @@ -318,11 +301,6 @@ internal sealed class ConcreteClass1_AssertClassName_TestSource_GUID : global::T }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.AbstractTests.ConcreteClass1(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.AbstractTests.ConcreteClass1)instance; - await typedInstance.AssertClassName(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.AssertClassName(); diff --git a/TUnit.Core.SourceGenerator.Tests/AfterAllTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/AfterAllTests.Test.verified.txt index a76fb8ddea..9b3ea6d68c 100644 --- a/TUnit.Core.SourceGenerator.Tests/AfterAllTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AfterAllTests.Test.verified.txt @@ -55,11 +55,6 @@ internal sealed class CleanupTests_Test1_TestSource_GUID : global::TUnit.Core.In }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.AfterTests.CleanupTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.AfterTests.CleanupTests)instance; - await typedInstance.Test1(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.Test1(); @@ -139,11 +134,6 @@ internal sealed class CleanupTests_Test2_TestSource_GUID : global::TUnit.Core.In }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.AfterTests.CleanupTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.AfterTests.CleanupTests)instance; - await typedInstance.Test2(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.Test2(); diff --git a/TUnit.Core.SourceGenerator.Tests/AfterTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/AfterTests.Test.verified.txt index a76fb8ddea..9b3ea6d68c 100644 --- a/TUnit.Core.SourceGenerator.Tests/AfterTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AfterTests.Test.verified.txt @@ -55,11 +55,6 @@ internal sealed class CleanupTests_Test1_TestSource_GUID : global::TUnit.Core.In }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.AfterTests.CleanupTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.AfterTests.CleanupTests)instance; - await typedInstance.Test1(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.Test1(); @@ -139,11 +134,6 @@ internal sealed class CleanupTests_Test2_TestSource_GUID : global::TUnit.Core.In }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.AfterTests.CleanupTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.AfterTests.CleanupTests)instance; - await typedInstance.Test2(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.Test2(); diff --git a/TUnit.Core.SourceGenerator.Tests/ArgsAsArrayTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ArgsAsArrayTests.Test.verified.txt index 7bee396621..97ff7911a6 100644 --- a/TUnit.Core.SourceGenerator.Tests/ArgsAsArrayTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ArgsAsArrayTests.Test.verified.txt @@ -67,37 +67,6 @@ internal sealed class ArgsAsArrayTests_Params_TestSource_GUID : global::TUnit.Co }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.ArgsAsArrayTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.ArgsAsArrayTests)instance; - switch (args.Length) - { - case 0: - typedInstance.Params(new string[0]); - break; - case 1: - typedInstance.Params(new string[] { TUnit.Core.Helpers.CastHelper.Cast(args[0]) }); - break; - case 2: - typedInstance.Params(new string[] { TUnit.Core.Helpers.CastHelper.Cast(args[0]), TUnit.Core.Helpers.CastHelper.Cast(args[1]) }); - break; - case 3: - typedInstance.Params(new string[] { TUnit.Core.Helpers.CastHelper.Cast(args[0]), TUnit.Core.Helpers.CastHelper.Cast(args[1]), TUnit.Core.Helpers.CastHelper.Cast(args[2]) }); - break; - case 4: - typedInstance.Params(new string[] { TUnit.Core.Helpers.CastHelper.Cast(args[0]), TUnit.Core.Helpers.CastHelper.Cast(args[1]), TUnit.Core.Helpers.CastHelper.Cast(args[2]), TUnit.Core.Helpers.CastHelper.Cast(args[3]) }); - break; - case 5: - typedInstance.Params(new string[] { TUnit.Core.Helpers.CastHelper.Cast(args[0]), TUnit.Core.Helpers.CastHelper.Cast(args[1]), TUnit.Core.Helpers.CastHelper.Cast(args[2]), TUnit.Core.Helpers.CastHelper.Cast(args[3]), TUnit.Core.Helpers.CastHelper.Cast(args[4]) }); - break; - case 6: - typedInstance.Params(new string[] { TUnit.Core.Helpers.CastHelper.Cast(args[0]), TUnit.Core.Helpers.CastHelper.Cast(args[1]), TUnit.Core.Helpers.CastHelper.Cast(args[2]), TUnit.Core.Helpers.CastHelper.Cast(args[3]), TUnit.Core.Helpers.CastHelper.Cast(args[4]), TUnit.Core.Helpers.CastHelper.Cast(args[5]) }); - break; - default: - throw new global::System.ArgumentException($"Expected between 0 and 1 arguments, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -215,19 +184,6 @@ internal sealed class ArgsAsArrayTests_NonParams_TestSource_GUID : global::TUnit }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.ArgsAsArrayTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.ArgsAsArrayTests)instance; - switch (args.Length) - { - case 1: - typedInstance.NonParams(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -327,37 +283,6 @@ internal sealed class ArgsAsArrayTests_ParamsEnumerable_TestSource_GUID : global }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.ArgsAsArrayTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.ArgsAsArrayTests)instance; - switch (args.Length) - { - case 0: - typedInstance.ParamsEnumerable(TUnit.Core.Helpers.CastHelper.Cast>(args[0])); - break; - case 1: - typedInstance.ParamsEnumerable(TUnit.Core.Helpers.CastHelper.Cast>(args[0])); - break; - case 2: - typedInstance.ParamsEnumerable(TUnit.Core.Helpers.CastHelper.Cast>(args[0])); - break; - case 3: - typedInstance.ParamsEnumerable(TUnit.Core.Helpers.CastHelper.Cast>(args[0])); - break; - case 4: - typedInstance.ParamsEnumerable(TUnit.Core.Helpers.CastHelper.Cast>(args[0])); - break; - case 5: - typedInstance.ParamsEnumerable(TUnit.Core.Helpers.CastHelper.Cast>(args[0])); - break; - case 6: - typedInstance.ParamsEnumerable(TUnit.Core.Helpers.CastHelper.Cast>(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected between 0 and 1 arguments, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -475,19 +400,6 @@ internal sealed class ArgsAsArrayTests_Enumerable_TestSource_GUID : global::TUni }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.ArgsAsArrayTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.ArgsAsArrayTests)instance; - switch (args.Length) - { - case 1: - typedInstance.Enumerable(TUnit.Core.Helpers.CastHelper.Cast>(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -594,19 +506,6 @@ internal sealed class ArgsAsArrayTests_Following_Non_Params_TestSource_GUID : gl }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.ArgsAsArrayTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.ArgsAsArrayTests)instance; - switch (args.Length) - { - case 2: - typedInstance.Following_Non_Params(TUnit.Core.Helpers.CastHelper.Cast(args[0]), TUnit.Core.Helpers.CastHelper.Cast>(args[1])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) diff --git a/TUnit.Core.SourceGenerator.Tests/ArgumentWithImplicitConverterTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ArgumentWithImplicitConverterTests.Test.verified.txt index 21f00af10f..54faca884b 100644 --- a/TUnit.Core.SourceGenerator.Tests/ArgumentWithImplicitConverterTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ArgumentWithImplicitConverterTests.Test.verified.txt @@ -70,19 +70,6 @@ internal sealed class ArgumentWithImplicitConverterTests_Explicit_TestSource_GUI }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.ArgumentWithImplicitConverterTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.ArgumentWithImplicitConverterTests)instance; - switch (args.Length) - { - case 1: - typedInstance.Explicit(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -185,19 +172,6 @@ internal sealed class ArgumentWithImplicitConverterTests_Implicit_TestSource_GUI }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.ArgumentWithImplicitConverterTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.ArgumentWithImplicitConverterTests)instance; - switch (args.Length) - { - case 1: - typedInstance.Implicit(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) diff --git a/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet8_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet8_0.verified.txt index a6fdea02c3..5f18b8ee5b 100644 --- a/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet8_0.verified.txt @@ -55,12 +55,6 @@ internal sealed class BasicTests_SynchronousTest_TestSource_GUID : global::TUnit }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.BasicTests)instance; - typedInstance.SynchronousTest(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.SynchronousTest(); @@ -141,11 +135,6 @@ internal sealed class BasicTests_AsynchronousTest_TestSource_GUID : global::TUni }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.BasicTests)instance; - await typedInstance.AsynchronousTest(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.AsynchronousTest(); @@ -225,11 +214,6 @@ internal sealed class BasicTests_ValueTaskAsynchronousTest_TestSource_GUID : glo }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.BasicTests)instance; - await typedInstance.ValueTaskAsynchronousTest(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.ValueTaskAsynchronousTest(); diff --git a/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet9_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet9_0.verified.txt index a6fdea02c3..5f18b8ee5b 100644 --- a/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet9_0.verified.txt @@ -55,12 +55,6 @@ internal sealed class BasicTests_SynchronousTest_TestSource_GUID : global::TUnit }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.BasicTests)instance; - typedInstance.SynchronousTest(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.SynchronousTest(); @@ -141,11 +135,6 @@ internal sealed class BasicTests_AsynchronousTest_TestSource_GUID : global::TUni }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.BasicTests)instance; - await typedInstance.AsynchronousTest(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.AsynchronousTest(); @@ -225,11 +214,6 @@ internal sealed class BasicTests_ValueTaskAsynchronousTest_TestSource_GUID : glo }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.BasicTests)instance; - await typedInstance.ValueTaskAsynchronousTest(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.ValueTaskAsynchronousTest(); diff --git a/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.Net4_7.verified.txt b/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.Net4_7.verified.txt index 7dfb060be6..ea4070a9a9 100644 --- a/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.Net4_7.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.Net4_7.verified.txt @@ -55,12 +55,6 @@ internal sealed class BasicTests_SynchronousTest_TestSource_GUID : global::TUnit }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.BasicTests)instance; - typedInstance.SynchronousTest(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.SynchronousTest(); @@ -141,11 +135,6 @@ internal sealed class BasicTests_AsynchronousTest_TestSource_GUID : global::TUni }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.BasicTests)instance; - await typedInstance.AsynchronousTest(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.AsynchronousTest(); @@ -225,11 +214,6 @@ internal sealed class BasicTests_ValueTaskAsynchronousTest_TestSource_GUID : glo }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.BasicTests)instance; - await typedInstance.ValueTaskAsynchronousTest(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.ValueTaskAsynchronousTest(); diff --git a/TUnit.Core.SourceGenerator.Tests/AsyncMethodDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/AsyncMethodDataSourceDrivenTests.Test.verified.txt index 35f44841f8..79ef73b8a7 100644 --- a/TUnit.Core.SourceGenerator.Tests/AsyncMethodDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AsyncMethodDataSourceDrivenTests.Test.verified.txt @@ -89,18 +89,6 @@ internal sealed class AsyncMethodDataSourceDrivenTests_AsyncMethodDataSource_Sin }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests)instance; - switch (args.Length) - { - case 1: - await typedInstance.AsyncMethodDataSource_SingleValue(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -228,18 +216,6 @@ internal sealed class AsyncMethodDataSourceDrivenTests_AsyncMethodDataSource_Tup }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests)instance; - switch (args.Length) - { - case 2: - await typedInstance.AsyncMethodDataSource_Tuples(TUnit.Core.Helpers.CastHelper.Cast(args[0]), TUnit.Core.Helpers.CastHelper.Cast(args[1])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -360,18 +336,6 @@ internal sealed class AsyncMethodDataSourceDrivenTests_AsyncMethodDataSource_Enu }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests)instance; - switch (args.Length) - { - case 1: - await typedInstance.AsyncMethodDataSource_Enumerable(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -492,18 +456,6 @@ internal sealed class AsyncMethodDataSourceDrivenTests_AsyncMethodDataSource_Fun }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests)instance; - switch (args.Length) - { - case 1: - await typedInstance.AsyncMethodDataSource_Func(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -624,18 +576,6 @@ internal sealed class AsyncMethodDataSourceDrivenTests_AsyncMethodDataSource_Wit }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests)instance; - switch (args.Length) - { - case 1: - await typedInstance.AsyncMethodDataSource_WithArguments(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -756,18 +696,6 @@ internal sealed class AsyncMethodDataSourceDrivenTests_AsyncMethodDataSource_Ext }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests)instance; - switch (args.Length) - { - case 1: - await typedInstance.AsyncMethodDataSource_ExternalClass(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -888,18 +816,6 @@ internal sealed class AsyncMethodDataSourceDrivenTests_ValueTaskMethodDataSource }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests)instance; - switch (args.Length) - { - case 1: - await typedInstance.ValueTaskMethodDataSource_SingleValue(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) diff --git a/TUnit.Core.SourceGenerator.Tests/AttributeTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/AttributeTests.Test.verified.txt index f4b137c496..74dd9044e1 100644 --- a/TUnit.Core.SourceGenerator.Tests/AttributeTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AttributeTests.Test.verified.txt @@ -67,12 +67,6 @@ internal sealed class AttributeTests_MyTest_TestSource_GUID : global::TUnit.Core }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.AttributeTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.AttributeTests)instance; - typedInstance.MyTest(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.MyTest(); diff --git a/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet8_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet8_0.verified.txt index a6fdea02c3..5f18b8ee5b 100644 --- a/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet8_0.verified.txt @@ -55,12 +55,6 @@ internal sealed class BasicTests_SynchronousTest_TestSource_GUID : global::TUnit }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.BasicTests)instance; - typedInstance.SynchronousTest(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.SynchronousTest(); @@ -141,11 +135,6 @@ internal sealed class BasicTests_AsynchronousTest_TestSource_GUID : global::TUni }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.BasicTests)instance; - await typedInstance.AsynchronousTest(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.AsynchronousTest(); @@ -225,11 +214,6 @@ internal sealed class BasicTests_ValueTaskAsynchronousTest_TestSource_GUID : glo }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.BasicTests)instance; - await typedInstance.ValueTaskAsynchronousTest(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.ValueTaskAsynchronousTest(); diff --git a/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet9_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet9_0.verified.txt index a6fdea02c3..5f18b8ee5b 100644 --- a/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet9_0.verified.txt @@ -55,12 +55,6 @@ internal sealed class BasicTests_SynchronousTest_TestSource_GUID : global::TUnit }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.BasicTests)instance; - typedInstance.SynchronousTest(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.SynchronousTest(); @@ -141,11 +135,6 @@ internal sealed class BasicTests_AsynchronousTest_TestSource_GUID : global::TUni }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.BasicTests)instance; - await typedInstance.AsynchronousTest(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.AsynchronousTest(); @@ -225,11 +214,6 @@ internal sealed class BasicTests_ValueTaskAsynchronousTest_TestSource_GUID : glo }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.BasicTests)instance; - await typedInstance.ValueTaskAsynchronousTest(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.ValueTaskAsynchronousTest(); diff --git a/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.Net4_7.verified.txt b/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.Net4_7.verified.txt index 7dfb060be6..ea4070a9a9 100644 --- a/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.Net4_7.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.Net4_7.verified.txt @@ -55,12 +55,6 @@ internal sealed class BasicTests_SynchronousTest_TestSource_GUID : global::TUnit }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.BasicTests)instance; - typedInstance.SynchronousTest(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.SynchronousTest(); @@ -141,11 +135,6 @@ internal sealed class BasicTests_AsynchronousTest_TestSource_GUID : global::TUni }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.BasicTests)instance; - await typedInstance.AsynchronousTest(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.AsynchronousTest(); @@ -225,11 +214,6 @@ internal sealed class BasicTests_ValueTaskAsynchronousTest_TestSource_GUID : glo }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.BasicTests)instance; - await typedInstance.ValueTaskAsynchronousTest(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.ValueTaskAsynchronousTest(); diff --git a/TUnit.Core.SourceGenerator.Tests/BeforeAllTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/BeforeAllTests.Test.verified.txt index 97c55d979e..e73c595c6e 100644 --- a/TUnit.Core.SourceGenerator.Tests/BeforeAllTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/BeforeAllTests.Test.verified.txt @@ -55,11 +55,6 @@ internal sealed class SetupTests_Test1_TestSource_GUID : global::TUnit.Core.Inte }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.BeforeTests.SetupTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.BeforeTests.SetupTests)instance; - await typedInstance.Test1(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.Test1(); @@ -139,11 +134,6 @@ internal sealed class SetupTests_Test2_TestSource_GUID : global::TUnit.Core.Inte }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.BeforeTests.SetupTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.BeforeTests.SetupTests)instance; - await typedInstance.Test2(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.Test2(); diff --git a/TUnit.Core.SourceGenerator.Tests/BeforeTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/BeforeTests.Test.verified.txt index 97c55d979e..e73c595c6e 100644 --- a/TUnit.Core.SourceGenerator.Tests/BeforeTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/BeforeTests.Test.verified.txt @@ -55,11 +55,6 @@ internal sealed class SetupTests_Test1_TestSource_GUID : global::TUnit.Core.Inte }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.BeforeTests.SetupTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.BeforeTests.SetupTests)instance; - await typedInstance.Test1(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.Test1(); @@ -139,11 +134,6 @@ internal sealed class SetupTests_Test2_TestSource_GUID : global::TUnit.Core.Inte }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.BeforeTests.SetupTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.BeforeTests.SetupTests)instance; - await typedInstance.Test2(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.Test2(); diff --git a/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet8_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet8_0.verified.txt index 9718b7bb1a..e5d849e14d 100644 --- a/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet8_0.verified.txt @@ -56,12 +56,6 @@ internal sealed class Tests_SimpleTest_TestSource_GUID : global::TUnit.Core.Inte }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.Bugs._2971.Tests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.Bugs._2971.Tests)instance; - typedInstance.SimpleTest(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.SimpleTest(); diff --git a/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet9_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet9_0.verified.txt index 9718b7bb1a..e5d849e14d 100644 --- a/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet9_0.verified.txt @@ -56,12 +56,6 @@ internal sealed class Tests_SimpleTest_TestSource_GUID : global::TUnit.Core.Inte }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.Bugs._2971.Tests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.Bugs._2971.Tests)instance; - typedInstance.SimpleTest(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.SimpleTest(); diff --git a/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.Net4_7.verified.txt b/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.Net4_7.verified.txt index c189077036..ac2ef85dd5 100644 --- a/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.Net4_7.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.Net4_7.verified.txt @@ -56,12 +56,6 @@ internal sealed class Tests_SimpleTest_TestSource_GUID : global::TUnit.Core.Inte }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.Bugs._2971.Tests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.Bugs._2971.Tests)instance; - typedInstance.SimpleTest(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.SimpleTest(); diff --git a/TUnit.Core.SourceGenerator.Tests/ClassAndMethodArgumentsTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassAndMethodArgumentsTests.Test.verified.txt index ed3be73b16..f9f312ef66 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassAndMethodArgumentsTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ClassAndMethodArgumentsTests.Test.verified.txt @@ -73,11 +73,6 @@ internal sealed class ClassAndMethodArgumentsTests_Simple_TestSource_GUID : glob { return new global::TUnit.TestProject.ClassAndMethodArgumentsTests(TUnit.Core.Helpers.CastHelper.Cast(args[0])); }, - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.ClassAndMethodArgumentsTests)instance; - await typedInstance.Simple(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.Simple(); @@ -188,18 +183,6 @@ internal sealed class ClassAndMethodArgumentsTests_WithMethodLevel_TestSource_GU { return new global::TUnit.TestProject.ClassAndMethodArgumentsTests(TUnit.Core.Helpers.CastHelper.Cast(args[0])); }, - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.ClassAndMethodArgumentsTests)instance; - switch (args.Length) - { - case 1: - await typedInstance.WithMethodLevel(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -317,18 +300,6 @@ internal sealed class ClassAndMethodArgumentsTests_IgnoreParameters_TestSource_G { return new global::TUnit.TestProject.ClassAndMethodArgumentsTests(TUnit.Core.Helpers.CastHelper.Cast(args[0])); }, - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.ClassAndMethodArgumentsTests)instance; - switch (args.Length) - { - case 1: - await typedInstance.IgnoreParameters(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) diff --git a/TUnit.Core.SourceGenerator.Tests/ClassConstructorTest.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassConstructorTest.Test.verified.txt index 171ab67cfa..ef04988102 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassConstructorTest.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ClassConstructorTest.Test.verified.txt @@ -82,12 +82,6 @@ internal sealed class ClassConstructorTest_Test_TestSource_GUID : global::TUnit. // ClassConstructor attribute is present - instance creation handled at runtime throw new global::System.NotSupportedException("Instance creation for classes with ClassConstructor attribute is handled at runtime"); }, - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.ClassConstructorTest)instance; - typedInstance.Test(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.Test(); diff --git a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests.Test.verified.txt index 71a9fe04e8..40f4ffee77 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests.Test.verified.txt @@ -68,19 +68,6 @@ internal sealed class ClassDataSourceDrivenTests_DataSource_Class_TestSource_GUI }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.ClassDataSourceDrivenTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.ClassDataSourceDrivenTests)instance; - switch (args.Length) - { - case 1: - typedInstance.DataSource_Class(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -181,19 +168,6 @@ internal sealed class ClassDataSourceDrivenTests_DataSource_Class_Generic_TestSo }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.ClassDataSourceDrivenTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.ClassDataSourceDrivenTests)instance; - switch (args.Length) - { - case 1: - typedInstance.DataSource_Class_Generic(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -294,18 +268,6 @@ internal sealed class ClassDataSourceDrivenTests_IsInitialized_With_1_ClassDataS }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.ClassDataSourceDrivenTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.ClassDataSourceDrivenTests)instance; - switch (args.Length) - { - case 1: - await typedInstance.IsInitialized_With_1_ClassDataSource(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -412,18 +374,6 @@ internal sealed class ClassDataSourceDrivenTests_IsInitialized_With_2_ClassDataS }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.ClassDataSourceDrivenTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.ClassDataSourceDrivenTests)instance; - switch (args.Length) - { - case 2: - await typedInstance.IsInitialized_With_2_ClassDataSources(TUnit.Core.Helpers.CastHelper.Cast(args[0]), TUnit.Core.Helpers.CastHelper.Cast(args[1])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -537,18 +487,6 @@ internal sealed class ClassDataSourceDrivenTests_IsInitialized_With_3_ClassDataS }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.ClassDataSourceDrivenTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.ClassDataSourceDrivenTests)instance; - switch (args.Length) - { - case 3: - await typedInstance.IsInitialized_With_3_ClassDataSources(TUnit.Core.Helpers.CastHelper.Cast(args[0]), TUnit.Core.Helpers.CastHelper.Cast(args[1]), TUnit.Core.Helpers.CastHelper.Cast(args[2])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -669,18 +607,6 @@ internal sealed class ClassDataSourceDrivenTests_IsInitialized_With_4_ClassDataS }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.ClassDataSourceDrivenTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.ClassDataSourceDrivenTests)instance; - switch (args.Length) - { - case 4: - await typedInstance.IsInitialized_With_4_ClassDataSources(TUnit.Core.Helpers.CastHelper.Cast(args[0]), TUnit.Core.Helpers.CastHelper.Cast(args[1]), TUnit.Core.Helpers.CastHelper.Cast(args[2]), TUnit.Core.Helpers.CastHelper.Cast(args[3])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 4 arguments, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -808,18 +734,6 @@ internal sealed class ClassDataSourceDrivenTests_IsInitialized_With_5_ClassDataS }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.ClassDataSourceDrivenTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.ClassDataSourceDrivenTests)instance; - switch (args.Length) - { - case 5: - await typedInstance.IsInitialized_With_5_ClassDataSources(TUnit.Core.Helpers.CastHelper.Cast(args[0]), TUnit.Core.Helpers.CastHelper.Cast(args[1]), TUnit.Core.Helpers.CastHelper.Cast(args[2]), TUnit.Core.Helpers.CastHelper.Cast(args[3]), TUnit.Core.Helpers.CastHelper.Cast(args[4])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 5 arguments, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) diff --git a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests2.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests2.Test.verified.txt index fe8fe558b4..6ccc60e2bf 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests2.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests2.Test.verified.txt @@ -74,12 +74,6 @@ internal sealed class ClassDataSourceDrivenTests2_Base_Derived1_TestSource_GUID { return new global::TUnit.TestProject.ClassDataSourceDrivenTests2(TUnit.Core.Helpers.CastHelper.Cast(args[0])); }, - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.ClassDataSourceDrivenTests2)instance; - typedInstance.Base_Derived1(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.Base_Derived1(); @@ -179,12 +173,6 @@ internal sealed class ClassDataSourceDrivenTests2_Base_Derived2_TestSource_GUID { return new global::TUnit.TestProject.ClassDataSourceDrivenTests2(TUnit.Core.Helpers.CastHelper.Cast(args[0])); }, - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.ClassDataSourceDrivenTests2)instance; - typedInstance.Base_Derived2(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.Base_Derived2(); diff --git a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTestsSharedKeyed.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTestsSharedKeyed.Test.verified.txt index 94e899eceb..4ff5acba56 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTestsSharedKeyed.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTestsSharedKeyed.Test.verified.txt @@ -69,19 +69,6 @@ internal sealed class ClassDataSourceDrivenTestsSharedKeyed_DataSource_Class_Tes }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed)instance; - switch (args.Length) - { - case 1: - typedInstance.DataSource_Class(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -183,19 +170,6 @@ internal sealed class ClassDataSourceDrivenTestsSharedKeyed_DataSource_Class_Gen }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed)instance; - switch (args.Length) - { - case 1: - typedInstance.DataSource_Class_Generic(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) diff --git a/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.Test.verified.txt index 89dc171c3a..e2e9061fd5 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.Test.verified.txt @@ -357,19 +357,6 @@ internal sealed class ClassTupleDataSourceDrivenTests_DataSource_TupleMethod_Tes Property4 = default(global::System.ValueTuple), }; }, - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.ClassTupleDataSourceDrivenTests)instance; - switch (args.Length) - { - case 3: - typedInstance.DataSource_TupleMethod(TUnit.Core.Helpers.CastHelper.Cast(args[0]), TUnit.Core.Helpers.CastHelper.Cast(args[1]), TUnit.Core.Helpers.CastHelper.Cast(args[2])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) diff --git a/TUnit.Core.SourceGenerator.Tests/ConcreteClassTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConcreteClassTests.Test.verified.txt index 7e9528a128..1da5f79842 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConcreteClassTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConcreteClassTests.Test.verified.txt @@ -57,12 +57,6 @@ internal sealed class ConcreteClass2_SecondTest_TestSource_GUID : global::TUnit. }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.AbstractTests.ConcreteClass2(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.AbstractTests.ConcreteClass2)instance; - typedInstance.SecondTest(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.SecondTest(); @@ -145,11 +139,6 @@ internal sealed class ConcreteClass2_AssertClassName_TestSource_GUID : global::T }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.AbstractTests.ConcreteClass2(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.AbstractTests.ConcreteClass2)instance; - await typedInstance.AssertClassName(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.AssertClassName(); @@ -231,12 +220,6 @@ internal sealed class ConcreteClass2_SecondTest_TestSource_GUID : global::TUnit. }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.AbstractTests.ConcreteClass2(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.AbstractTests.ConcreteClass2)instance; - typedInstance.SecondTest(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.SecondTest(); @@ -318,11 +301,6 @@ internal sealed class ConcreteClass1_AssertClassName_TestSource_GUID : global::T }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.AbstractTests.ConcreteClass1(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.AbstractTests.ConcreteClass1)instance; - await typedInstance.AssertClassName(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.AssertClassName(); diff --git a/TUnit.Core.SourceGenerator.Tests/ConstantArgumentsTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConstantArgumentsTests.Test.verified.txt index c1003259b8..2ce3011a51 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConstantArgumentsTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConstantArgumentsTests.Test.verified.txt @@ -68,18 +68,6 @@ internal sealed class ConstantArgumentsTests_String1_TestSource_GUID : global::T }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.ConstantArgumentsTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.ConstantArgumentsTests)instance; - switch (args.Length) - { - case 1: - await typedInstance.String1(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -179,18 +167,6 @@ internal sealed class ConstantArgumentsTests_Int_TestSource_GUID : global::TUnit }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.ConstantArgumentsTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.ConstantArgumentsTests)instance; - switch (args.Length) - { - case 1: - await typedInstance.Int(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -290,18 +266,6 @@ internal sealed class ConstantArgumentsTests_Double_TestSource_GUID : global::TU }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.ConstantArgumentsTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.ConstantArgumentsTests)instance; - switch (args.Length) - { - case 1: - await typedInstance.Double(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -401,18 +365,6 @@ internal sealed class ConstantArgumentsTests_Float_TestSource_GUID : global::TUn }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.ConstantArgumentsTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.ConstantArgumentsTests)instance; - switch (args.Length) - { - case 1: - await typedInstance.Float(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -512,18 +464,6 @@ internal sealed class ConstantArgumentsTests_Long_TestSource_GUID : global::TUni }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.ConstantArgumentsTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.ConstantArgumentsTests)instance; - switch (args.Length) - { - case 1: - await typedInstance.Long(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -623,18 +563,6 @@ internal sealed class ConstantArgumentsTests_UInt_TestSource_GUID : global::TUni }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.ConstantArgumentsTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.ConstantArgumentsTests)instance; - switch (args.Length) - { - case 1: - await typedInstance.UInt(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -734,18 +662,6 @@ internal sealed class ConstantArgumentsTests_ULong_TestSource_GUID : global::TUn }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.ConstantArgumentsTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.ConstantArgumentsTests)instance; - switch (args.Length) - { - case 1: - await typedInstance.ULong(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) diff --git a/TUnit.Core.SourceGenerator.Tests/ConstantInBaseClassTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConstantInBaseClassTests.Test.verified.txt index ef3e725cf2..0e8ed529d1 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConstantInBaseClassTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConstantInBaseClassTests.Test.verified.txt @@ -68,18 +68,6 @@ internal sealed class ConstantInBaseClassTests_SomeTest_TestSource_GUID : global }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests)instance; - switch (args.Length) - { - case 1: - await typedInstance.SomeTest(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) diff --git a/TUnit.Core.SourceGenerator.Tests/ConstantsInInterpolatedStringsTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConstantsInInterpolatedStringsTests.Test.verified.txt index d41d2a0f8f..1c64a63bf9 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConstantsInInterpolatedStringsTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConstantsInInterpolatedStringsTests.Test.verified.txt @@ -68,18 +68,6 @@ internal sealed class ConstantsInInterpolatedStringsTests_SomeTest_TestSource_GU }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests)instance; - switch (args.Length) - { - case 1: - await typedInstance.SomeTest(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) diff --git a/TUnit.Core.SourceGenerator.Tests/CustomDisplayNameTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/CustomDisplayNameTests.Test.verified.txt index 19c4536dd1..a6f944d328 100644 --- a/TUnit.Core.SourceGenerator.Tests/CustomDisplayNameTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/CustomDisplayNameTests.Test.verified.txt @@ -70,11 +70,6 @@ internal sealed class CustomDisplayNameTests_Test_TestSource_GUID : global::TUni }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.CustomDisplayNameTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.CustomDisplayNameTests)instance; - await typedInstance.Test(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.Test(); @@ -169,11 +164,6 @@ internal sealed class CustomDisplayNameTests_Test2_TestSource_GUID : global::TUn }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.CustomDisplayNameTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.CustomDisplayNameTests)instance; - await typedInstance.Test2(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.Test2(); @@ -295,18 +285,6 @@ internal sealed class CustomDisplayNameTests_Test3_TestSource_GUID : global::TUn }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.CustomDisplayNameTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.CustomDisplayNameTests)instance; - switch (args.Length) - { - case 3: - await typedInstance.Test3(TUnit.Core.Helpers.CastHelper.Cast(args[0]), TUnit.Core.Helpers.CastHelper.Cast(args[1]), TUnit.Core.Helpers.CastHelper.Cast(args[2])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -431,18 +409,6 @@ internal sealed class CustomDisplayNameTests_MethodDataSourceTest_TestSource_GUI }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.CustomDisplayNameTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.CustomDisplayNameTests)instance; - switch (args.Length) - { - case 1: - await typedInstance.MethodDataSourceTest(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -565,18 +531,6 @@ internal sealed class CustomDisplayNameTests_TestParameterNamePrefixBug_TestSour }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.CustomDisplayNameTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.CustomDisplayNameTests)instance; - switch (args.Length) - { - case 2: - await typedInstance.TestParameterNamePrefixBug(TUnit.Core.Helpers.CastHelper.Cast(args[0]), TUnit.Core.Helpers.CastHelper.Cast(args[1])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -689,18 +643,6 @@ internal sealed class CustomDisplayNameTests_PasswordTest_TestSource_GUID : glob }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.CustomDisplayNameTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.CustomDisplayNameTests)instance; - switch (args.Length) - { - case 1: - await typedInstance.PasswordTest(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -802,11 +744,6 @@ internal sealed class CustomDisplayNameTests_SameClassConstantTest_TestSource_GU }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.CustomDisplayNameTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.CustomDisplayNameTests)instance; - await typedInstance.SameClassConstantTest(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.SameClassConstantTest(); @@ -901,11 +838,6 @@ internal sealed class CustomDisplayNameTests_DifferentClassConstantTest_TestSour }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.CustomDisplayNameTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.CustomDisplayNameTests)instance; - await typedInstance.DifferentClassConstantTest(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.DifferentClassConstantTest(); @@ -1000,11 +932,6 @@ internal sealed class CustomDisplayNameTests_NestedClassConstantTest_TestSource_ }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.CustomDisplayNameTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.CustomDisplayNameTests)instance; - await typedInstance.NestedClassConstantTest(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.NestedClassConstantTest(); diff --git a/TUnit.Core.SourceGenerator.Tests/DataDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/DataDrivenTests.Test.verified.txt index bd6694251a..3552003c46 100644 --- a/TUnit.Core.SourceGenerator.Tests/DataDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DataDrivenTests.Test.verified.txt @@ -70,19 +70,6 @@ internal sealed class DataDrivenTests_DataSource_Method_TestSource_GUID : global }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.DataDrivenTests)instance; - switch (args.Length) - { - case 1: - typedInstance.DataSource_Method(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -192,19 +179,6 @@ internal sealed class DataDrivenTests_DataSource_Method_TestSource_GUID : global }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.DataDrivenTests)instance; - switch (args.Length) - { - case 2: - typedInstance.DataSource_Method(TUnit.Core.Helpers.CastHelper.Cast(args[0]), TUnit.Core.Helpers.CastHelper.Cast(args[1])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -307,19 +281,6 @@ internal sealed class DataDrivenTests_EnumValue_TestSource_GUID : global::TUnit. }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.DataDrivenTests)instance; - switch (args.Length) - { - case 1: - typedInstance.EnumValue(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -420,19 +381,6 @@ internal sealed class DataDrivenTests_NullValue_TestSource_GUID : global::TUnit. }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.DataDrivenTests)instance; - switch (args.Length) - { - case 1: - typedInstance.NullValue(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -533,19 +481,6 @@ internal sealed class DataDrivenTests_EmptyString_TestSource_GUID : global::TUni }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.DataDrivenTests)instance; - switch (args.Length) - { - case 1: - typedInstance.EmptyString(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -646,19 +581,6 @@ internal sealed class DataDrivenTests_NonEmptyString_TestSource_GUID : global::T }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.DataDrivenTests)instance; - switch (args.Length) - { - case 1: - typedInstance.NonEmptyString(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -761,19 +683,6 @@ internal sealed class DataDrivenTests_BooleanString_TestSource_GUID : global::TU }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.DataDrivenTests)instance; - switch (args.Length) - { - case 1: - typedInstance.BooleanString(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -874,19 +783,6 @@ internal sealed class DataDrivenTests_Type_TestSource_GUID : global::TUnit.Core. }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.DataDrivenTests)instance; - switch (args.Length) - { - case 1: - typedInstance.Type(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -987,19 +883,6 @@ internal sealed class DataDrivenTests_IntegerArray_TestSource_GUID : global::TUn }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.DataDrivenTests)instance; - switch (args.Length) - { - case 1: - typedInstance.IntegerArray(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -1100,19 +983,6 @@ internal sealed class DataDrivenTests_IntMaxValue_TestSource_GUID : global::TUni }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.DataDrivenTests)instance; - switch (args.Length) - { - case 1: - typedInstance.IntMaxValue(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) diff --git a/TUnit.Core.SourceGenerator.Tests/DataSourceClassCombinedWithDataSourceMethodTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/DataSourceClassCombinedWithDataSourceMethodTests.Test.verified.txt index f03636f42b..61ad7430f2 100644 --- a/TUnit.Core.SourceGenerator.Tests/DataSourceClassCombinedWithDataSourceMethodTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DataSourceClassCombinedWithDataSourceMethodTests.Test.verified.txt @@ -156,19 +156,6 @@ internal sealed class DataSourceClassCombinedWithDataSourceMethod_DataSourceClas { return new global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod(TUnit.Core.Helpers.CastHelper.Cast(args[0])); }, - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod)instance; - switch (args.Length) - { - case 1: - typedInstance.DataSourceClassCombinedWithDataSourceMethodTest(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) diff --git a/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Typed.verified.txt b/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Typed.verified.txt index faafce358f..9a25992a0b 100644 --- a/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Typed.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Typed.verified.txt @@ -100,19 +100,6 @@ internal sealed class DataSourceGeneratorTests_GeneratedData_Method_TestSource_G { return new global::TUnit.TestProject.DataSourceGeneratorTests(TUnit.Core.Helpers.CastHelper.Cast(args[0]), TUnit.Core.Helpers.CastHelper.Cast(args[1]), TUnit.Core.Helpers.CastHelper.Cast(args[2])); }, - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.DataSourceGeneratorTests)instance; - switch (args.Length) - { - case 1: - typedInstance.GeneratedData_Method(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -259,19 +246,6 @@ internal sealed class DataSourceGeneratorTests_GeneratedData_Method2_TestSource_ { return new global::TUnit.TestProject.DataSourceGeneratorTests(TUnit.Core.Helpers.CastHelper.Cast(args[0]), TUnit.Core.Helpers.CastHelper.Cast(args[1]), TUnit.Core.Helpers.CastHelper.Cast(args[2])); }, - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.DataSourceGeneratorTests)instance; - switch (args.Length) - { - case 3: - typedInstance.GeneratedData_Method2(TUnit.Core.Helpers.CastHelper.Cast(args[0]), TUnit.Core.Helpers.CastHelper.Cast(args[1]), TUnit.Core.Helpers.CastHelper.Cast(args[2])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -418,19 +392,6 @@ internal sealed class DataSourceGeneratorTests_GeneratedData_Method3_TestSource_ { return new global::TUnit.TestProject.DataSourceGeneratorTests(TUnit.Core.Helpers.CastHelper.Cast(args[0]), TUnit.Core.Helpers.CastHelper.Cast(args[1]), TUnit.Core.Helpers.CastHelper.Cast(args[2])); }, - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.DataSourceGeneratorTests)instance; - switch (args.Length) - { - case 3: - typedInstance.GeneratedData_Method3(TUnit.Core.Helpers.CastHelper.Cast(args[0]), TUnit.Core.Helpers.CastHelper.Cast(args[1]), TUnit.Core.Helpers.CastHelper.Cast(args[2])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) diff --git a/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Untyped.verified.txt b/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Untyped.verified.txt index cf5c8366db..e0841fbca7 100644 --- a/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Untyped.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Untyped.verified.txt @@ -88,18 +88,6 @@ internal sealed class AutoDataTests_Test1_TestSource_GUID : global::TUnit.Core.I }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.AutoDataTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.AutoDataTests)instance; - switch (args.Length) - { - case 4: - await typedInstance.Test1(TUnit.Core.Helpers.CastHelper.Cast(args[0]), TUnit.Core.Helpers.CastHelper.Cast(args[1]), TUnit.Core.Helpers.CastHelper.Cast(args[2]), TUnit.Core.Helpers.CastHelper.Cast(args[3])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 4 arguments, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) diff --git a/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet8_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet8_0.verified.txt index a6fdea02c3..5f18b8ee5b 100644 --- a/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet8_0.verified.txt @@ -55,12 +55,6 @@ internal sealed class BasicTests_SynchronousTest_TestSource_GUID : global::TUnit }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.BasicTests)instance; - typedInstance.SynchronousTest(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.SynchronousTest(); @@ -141,11 +135,6 @@ internal sealed class BasicTests_AsynchronousTest_TestSource_GUID : global::TUni }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.BasicTests)instance; - await typedInstance.AsynchronousTest(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.AsynchronousTest(); @@ -225,11 +214,6 @@ internal sealed class BasicTests_ValueTaskAsynchronousTest_TestSource_GUID : glo }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.BasicTests)instance; - await typedInstance.ValueTaskAsynchronousTest(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.ValueTaskAsynchronousTest(); diff --git a/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet9_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet9_0.verified.txt index a6fdea02c3..5f18b8ee5b 100644 --- a/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet9_0.verified.txt @@ -55,12 +55,6 @@ internal sealed class BasicTests_SynchronousTest_TestSource_GUID : global::TUnit }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.BasicTests)instance; - typedInstance.SynchronousTest(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.SynchronousTest(); @@ -141,11 +135,6 @@ internal sealed class BasicTests_AsynchronousTest_TestSource_GUID : global::TUni }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.BasicTests)instance; - await typedInstance.AsynchronousTest(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.AsynchronousTest(); @@ -225,11 +214,6 @@ internal sealed class BasicTests_ValueTaskAsynchronousTest_TestSource_GUID : glo }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.BasicTests)instance; - await typedInstance.ValueTaskAsynchronousTest(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.ValueTaskAsynchronousTest(); diff --git a/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.Net4_7.verified.txt b/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.Net4_7.verified.txt index 7dfb060be6..ea4070a9a9 100644 --- a/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.Net4_7.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.Net4_7.verified.txt @@ -55,12 +55,6 @@ internal sealed class BasicTests_SynchronousTest_TestSource_GUID : global::TUnit }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.BasicTests)instance; - typedInstance.SynchronousTest(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.SynchronousTest(); @@ -141,11 +135,6 @@ internal sealed class BasicTests_AsynchronousTest_TestSource_GUID : global::TUni }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.BasicTests)instance; - await typedInstance.AsynchronousTest(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.AsynchronousTest(); @@ -225,11 +214,6 @@ internal sealed class BasicTests_ValueTaskAsynchronousTest_TestSource_GUID : glo }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.BasicTests)instance; - await typedInstance.ValueTaskAsynchronousTest(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.ValueTaskAsynchronousTest(); diff --git a/TUnit.Core.SourceGenerator.Tests/EnumMemberNamesTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/EnumMemberNamesTests.Test.verified.txt index 4f9613f40a..b358226155 100644 --- a/TUnit.Core.SourceGenerator.Tests/EnumMemberNamesTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/EnumMemberNamesTests.Test.verified.txt @@ -70,19 +70,6 @@ internal sealed class EnumMemberNamesTests_SomeTest_TestSource_GUID : global::TU }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests)instance; - switch (args.Length) - { - case 1: - typedInstance.SomeTest(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) diff --git a/TUnit.Core.SourceGenerator.Tests/EnumerableDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/EnumerableDataSourceDrivenTests.Test.verified.txt index ae37999ebb..00049955f8 100644 --- a/TUnit.Core.SourceGenerator.Tests/EnumerableDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/EnumerableDataSourceDrivenTests.Test.verified.txt @@ -89,18 +89,6 @@ internal sealed class EnumerableDataSourceDrivenTests_DataSource_Method_TestSour }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.EnumerableDataSourceDrivenTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.EnumerableDataSourceDrivenTests)instance; - switch (args.Length) - { - case 1: - await typedInstance.DataSource_Method(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -221,18 +209,6 @@ internal sealed class EnumerableDataSourceDrivenTests_DataSource_Method2_TestSou }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.EnumerableDataSourceDrivenTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.EnumerableDataSourceDrivenTests)instance; - switch (args.Length) - { - case 1: - await typedInstance.DataSource_Method2(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -353,19 +329,6 @@ internal sealed class EnumerableDataSourceDrivenTests_DataSource_WithBaseReturn_ }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.EnumerableDataSourceDrivenTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.EnumerableDataSourceDrivenTests)instance; - switch (args.Length) - { - case 1: - typedInstance.DataSource_WithBaseReturn(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) diff --git a/TUnit.Core.SourceGenerator.Tests/EnumerableTupleDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/EnumerableTupleDataSourceDrivenTests.Test.verified.txt index 0884280fd2..966e4ab394 100644 --- a/TUnit.Core.SourceGenerator.Tests/EnumerableTupleDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/EnumerableTupleDataSourceDrivenTests.Test.verified.txt @@ -125,19 +125,6 @@ internal sealed class EnumerableTupleDataSourceDrivenTests_DataSource_TupleMetho }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests)instance; - switch (args.Length) - { - case 3: - typedInstance.DataSource_TupleMethod(TUnit.Core.Helpers.CastHelper.Cast(args[0]), TUnit.Core.Helpers.CastHelper.Cast(args[1]), TUnit.Core.Helpers.CastHelper.Cast(args[2])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) diff --git a/TUnit.Core.SourceGenerator.Tests/ExpectedArgumentTypeTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ExpectedArgumentTypeTests.Test.verified.txt index 74085b70e9..4c1a8b6f67 100644 --- a/TUnit.Core.SourceGenerator.Tests/ExpectedArgumentTypeTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ExpectedArgumentTypeTests.Test.verified.txt @@ -87,18 +87,6 @@ internal sealed class ExpectedArgumentTypeTests_TypedArguments_TestSource_GUID : }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.ExpectedArgumentTypeTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.ExpectedArgumentTypeTests)instance; - switch (args.Length) - { - case 2: - await typedInstance.TypedArguments(TUnit.Core.Helpers.CastHelper.Cast(args[0]), TUnit.Core.Helpers.CastHelper.Cast(args[1])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -219,18 +207,6 @@ internal sealed class ExpectedArgumentTypeTests_EnumTypes_TestSource_GUID : glob }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.ExpectedArgumentTypeTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.ExpectedArgumentTypeTests)instance; - switch (args.Length) - { - case 3: - await typedInstance.EnumTypes(TUnit.Core.Helpers.CastHelper.Cast(args[0]), TUnit.Core.Helpers.CastHelper.Cast(args[1]), TUnit.Core.Helpers.CastHelper.Cast(args[2])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) diff --git a/TUnit.Core.SourceGenerator.Tests/GenericMethodTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/GenericMethodTests.Test.verified.txt index 3a72e2d251..a68d94de93 100644 --- a/TUnit.Core.SourceGenerator.Tests/GenericMethodTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/GenericMethodTests.Test.verified.txt @@ -104,41 +104,6 @@ internal sealed class GenericMethodTests_AggregateBy_HasExpectedOutput_TestSourc { return new global::TUnit.TestProject.GenericMethodTests(); }, - TestInvoker = async (instance, args) => - { - var instanceType = instance.GetType(); - var method = instanceType.GetMethod("AggregateBy_HasExpectedOutput", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.Instance); - if (method == null) - { - throw new global::System.InvalidOperationException($"Method 'AggregateBy_HasExpectedOutput' not found on type {instanceType.FullName}"); - } - // Make the method generic if it has type parameters - if (method.IsGenericMethodDefinition) - { - // Use the resolved generic types from the test context - var testContext = global::TUnit.Core.TestContext.Current; - var resolvedTypes = testContext?.TestDetails?.MethodGenericArguments; - if (resolvedTypes != null && resolvedTypes.Length > 0) - { - // Use the pre-resolved generic types - method = method.MakeGenericMethod(resolvedTypes); - } - else - { - // Fallback: infer type arguments from the actual argument types - var typeArgs = new global::System.Type[3]; - for (int i = 0; i < typeArgs.Length && i < args.Length; i++) - { - typeArgs[i] = args[i]?.GetType() ?? typeof(object); - } - method = method.MakeGenericMethod(typeArgs); - } - } - var methodArgs = new object?[args.Length]; - args.CopyTo(methodArgs, 0); - // Invoke the method - var result = method.Invoke(instance, methodArgs); - }, ConcreteInstantiations = new global::System.Collections.Generic.Dictionary { [(typeof(int).FullName ?? typeof(int).Name) + "," + (typeof(int).FullName ?? typeof(int).Name) + "," + (typeof(int).FullName ?? typeof(int).Name)] = diff --git a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_EmptyGenericRegistry_WhenNoGenericsFound.verified.txt b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_EmptyGenericRegistry_WhenNoGenericsFound.verified.txt index 83d9c8b2bc..c840cb1e57 100644 --- a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_EmptyGenericRegistry_WhenNoGenericsFound.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_EmptyGenericRegistry_WhenNoGenericsFound.verified.txt @@ -55,12 +55,6 @@ internal sealed class SimpleTestClass_NonGenericTest_TestSource_GUID : global::T }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.SimpleTestClass(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.SimpleTestClass)instance; - typedInstance.NonGenericTest(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.NonGenericTest(); diff --git a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_GenericConstraints_WithInstantiation.verified.txt b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_GenericConstraints_WithInstantiation.verified.txt index f5564307e0..32ed9e2968 100644 --- a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_GenericConstraints_WithInstantiation.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_GenericConstraints_WithInstantiation.verified.txt @@ -67,19 +67,6 @@ internal sealed class ConstrainedGenericTestClass_TestMethod_TestSource_GUID : g } throw new global::System.InvalidOperationException("No type arguments provided for generic class"); }, - TestInvoker = async (instance, args) => - { - var instanceType = instance.GetType(); - var method = instanceType.GetMethod("TestMethod", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.Instance); - if (method == null) - { - throw new global::System.InvalidOperationException($"Method 'TestMethod' not found on type {instanceType.FullName}"); - } - var methodArgs = new object?[args.Length]; - args.CopyTo(methodArgs, 0); - // Invoke the method - var result = method.Invoke(instance, methodArgs); - }, ConcreteInstantiations = new global::System.Collections.Generic.Dictionary { [(typeof(string).FullName ?? typeof(string).Name)] = diff --git a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_GenericTestClass_WithExplicitInstantiation.verified.txt b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_GenericTestClass_WithExplicitInstantiation.verified.txt index 668d8cfbd2..14f283a284 100644 --- a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_GenericTestClass_WithExplicitInstantiation.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_GenericTestClass_WithExplicitInstantiation.verified.txt @@ -67,19 +67,6 @@ internal sealed class GenericTestClass_TestMethod_TestSource_GUID : global::TUni } throw new global::System.InvalidOperationException("No type arguments provided for generic class"); }, - TestInvoker = async (instance, args) => - { - var instanceType = instance.GetType(); - var method = instanceType.GetMethod("TestMethod", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.Instance); - if (method == null) - { - throw new global::System.InvalidOperationException($"Method 'TestMethod' not found on type {instanceType.FullName}"); - } - var methodArgs = new object?[args.Length]; - args.CopyTo(methodArgs, 0); - // Invoke the method - var result = method.Invoke(instance, methodArgs); - }, ConcreteInstantiations = new global::System.Collections.Generic.Dictionary { [(typeof(int).FullName ?? typeof(int).Name)] = diff --git a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_GenericTestMethod_WithExplicitInstantiation.verified.txt b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_GenericTestMethod_WithExplicitInstantiation.verified.txt index 341caf9d22..285817b109 100644 --- a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_GenericTestMethod_WithExplicitInstantiation.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_GenericTestMethod_WithExplicitInstantiation.verified.txt @@ -61,41 +61,6 @@ internal sealed class TestClass_GenericTestMethod_TestSource_GUID : global::TUni { return new global::TUnit.TestProject.TestClass(); }, - TestInvoker = async (instance, args) => - { - var instanceType = instance.GetType(); - var method = instanceType.GetMethod("GenericTestMethod", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.Instance); - if (method == null) - { - throw new global::System.InvalidOperationException($"Method 'GenericTestMethod' not found on type {instanceType.FullName}"); - } - // Make the method generic if it has type parameters - if (method.IsGenericMethodDefinition) - { - // Use the resolved generic types from the test context - var testContext = global::TUnit.Core.TestContext.Current; - var resolvedTypes = testContext?.TestDetails?.MethodGenericArguments; - if (resolvedTypes != null && resolvedTypes.Length > 0) - { - // Use the pre-resolved generic types - method = method.MakeGenericMethod(resolvedTypes); - } - else - { - // Fallback: infer type arguments from the actual argument types - var typeArgs = new global::System.Type[1]; - for (int i = 0; i < typeArgs.Length && i < args.Length; i++) - { - typeArgs[i] = args[i]?.GetType() ?? typeof(object); - } - method = method.MakeGenericMethod(typeArgs); - } - } - var methodArgs = new object?[args.Length]; - args.CopyTo(methodArgs, 0); - // Invoke the method - var result = method.Invoke(instance, methodArgs); - }, ConcreteInstantiations = new global::System.Collections.Generic.Dictionary { [(typeof(int).FullName ?? typeof(int).Name)] = diff --git a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_MultipleGenericParameters.verified.txt b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_MultipleGenericParameters.verified.txt index e18188c07b..091d51bc4f 100644 --- a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_MultipleGenericParameters.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_MultipleGenericParameters.verified.txt @@ -67,19 +67,6 @@ internal sealed class MultiGenericTestClass_TestMethod_TestSource_GUID : global: } throw new global::System.InvalidOperationException("No type arguments provided for generic class"); }, - TestInvoker = async (instance, args) => - { - var instanceType = instance.GetType(); - var method = instanceType.GetMethod("TestMethod", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.Instance); - if (method == null) - { - throw new global::System.InvalidOperationException($"Method 'TestMethod' not found on type {instanceType.FullName}"); - } - var methodArgs = new object?[args.Length]; - args.CopyTo(methodArgs, 0); - // Invoke the method - var result = method.Invoke(instance, methodArgs); - }, ConcreteInstantiations = new global::System.Collections.Generic.Dictionary { [(typeof(int).FullName ?? typeof(int).Name) + "," + (typeof(string).FullName ?? typeof(string).Name)] = diff --git a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_NestedGenericTypes.verified.txt b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_NestedGenericTypes.verified.txt index 0ba6167444..941e3de316 100644 --- a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_NestedGenericTypes.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_NestedGenericTypes.verified.txt @@ -67,19 +67,6 @@ internal sealed class NestedGenericTestClass_TestMethod_TestSource_GUID : global } throw new global::System.InvalidOperationException("No type arguments provided for generic class"); }, - TestInvoker = async (instance, args) => - { - var instanceType = instance.GetType(); - var method = instanceType.GetMethod("TestMethod", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.Instance); - if (method == null) - { - throw new global::System.InvalidOperationException($"Method 'TestMethod' not found on type {instanceType.FullName}"); - } - var methodArgs = new object?[args.Length]; - args.CopyTo(methodArgs, 0); - // Invoke the method - var result = method.Invoke(instance, methodArgs); - }, ConcreteInstantiations = new global::System.Collections.Generic.Dictionary { [(typeof(global::System.Collections.Generic.List).FullName ?? typeof(global::System.Collections.Generic.List).Name)] = diff --git a/TUnit.Core.SourceGenerator.Tests/Hooks1589.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Hooks1589.Test.verified.txt index 16c923ae7e..7ea8f73b7f 100644 --- a/TUnit.Core.SourceGenerator.Tests/Hooks1589.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Hooks1589.Test.verified.txt @@ -74,11 +74,6 @@ internal sealed class MyTests_Test1_TestSource_GUID : global::TUnit.Core.Interfa { return new global::TUnit.TestProject.Bugs._1589.MyTests(TUnit.Core.Helpers.CastHelper.Cast(args[0])); }, - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.Bugs._1589.MyTests)instance; - await typedInstance.Test1(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.Test1(); diff --git a/TUnit.Core.SourceGenerator.Tests/Hooks1594.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Hooks1594.Test.verified.txt index 9d55d59a47..4c18a7f1ed 100644 --- a/TUnit.Core.SourceGenerator.Tests/Hooks1594.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Hooks1594.Test.verified.txt @@ -74,12 +74,6 @@ internal sealed class MyTests_Test1_TestSource_GUID : global::TUnit.Core.Interfa { return new global::TUnit.TestProject.Bugs._1594.MyTests(TUnit.Core.Helpers.CastHelper.Cast(args[0])); }, - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.Bugs._1594.MyTests)instance; - typedInstance.Test1(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.Test1(); diff --git a/TUnit.Core.SourceGenerator.Tests/InheritedPropertySetterTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/InheritedPropertySetterTests.Test.verified.txt index a18893936b..5cb6cfe3ce 100644 --- a/TUnit.Core.SourceGenerator.Tests/InheritedPropertySetterTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/InheritedPropertySetterTests.Test.verified.txt @@ -320,11 +320,6 @@ internal sealed class PropertySetterTests_Test_TestSource_GUID : global::TUnit.C Property6 = default!, Property7 = default!, }, - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.PropertySetterTests)instance; - await typedInstance.Test(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.Test(); @@ -569,11 +564,6 @@ internal sealed class InheritedPropertySetterTests_Test_TestSource_GUID : global Property6 = default!, Property7 = default!, }, - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.InheritedPropertySetterTests)instance; - await typedInstance.Test(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.Test(); diff --git a/TUnit.Core.SourceGenerator.Tests/InheritedTestsFromDifferentProjectTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/InheritedTestsFromDifferentProjectTests.Test.verified.txt index 464767efce..4b74485855 100644 --- a/TUnit.Core.SourceGenerator.Tests/InheritedTestsFromDifferentProjectTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/InheritedTestsFromDifferentProjectTests.Test.verified.txt @@ -58,12 +58,6 @@ internal sealed class InheritedTestsFromDifferentProjectTests_Test_TestSource_GU }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests)instance; - typedInstance.Test(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.Test(); @@ -159,19 +153,6 @@ internal sealed class InheritedTestsFromDifferentProjectTests_GenericMethodDataS }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests)instance; - switch (args.Length) - { - case 1: - typedInstance.GenericMethodDataSource(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -285,19 +266,6 @@ internal sealed class InheritedTestsFromDifferentProjectTests_NonGenericMethodDa }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests)instance; - switch (args.Length) - { - case 1: - typedInstance.NonGenericMethodDataSource(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -388,11 +356,6 @@ internal sealed class InheritedTestsFromDifferentProjectTests_VerifyInheritedCat }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests)instance; - await typedInstance.VerifyInheritedCategoriesAreAvailable(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.VerifyInheritedCategoriesAreAvailable(); @@ -476,12 +439,6 @@ internal sealed class InheritedTestsFromDifferentProjectTests_BaseTest_TestSourc }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests)instance; - typedInstance.BaseTest(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.BaseTest(); @@ -567,12 +524,6 @@ internal sealed class InheritedTestsFromDifferentProjectTests_BaseTestWithMultip }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests)instance; - typedInstance.BaseTestWithMultipleCategories(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.BaseTestWithMultipleCategories(); @@ -656,12 +607,6 @@ internal sealed class InheritedTestsFromDifferentProjectTests_Test_TestSource_GU }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests)instance; - typedInstance.Test(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.Test(); @@ -757,19 +702,6 @@ internal sealed class InheritedTestsFromDifferentProjectTests_GenericMethodDataS }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests)instance; - switch (args.Length) - { - case 1: - typedInstance.GenericMethodDataSource(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -883,19 +815,6 @@ internal sealed class InheritedTestsFromDifferentProjectTests_NonGenericMethodDa }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests)instance; - switch (args.Length) - { - case 1: - typedInstance.NonGenericMethodDataSource(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -986,11 +905,6 @@ internal sealed class InheritedTestsFromDifferentProjectTests_VerifyInheritedCat }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests)instance; - await typedInstance.VerifyInheritedCategoriesAreAvailable(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.VerifyInheritedCategoriesAreAvailable(); diff --git a/TUnit.Core.SourceGenerator.Tests/InheritsTestsAbstractTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/InheritsTestsAbstractTests.Test.verified.txt index 7e9528a128..1da5f79842 100644 --- a/TUnit.Core.SourceGenerator.Tests/InheritsTestsAbstractTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/InheritsTestsAbstractTests.Test.verified.txt @@ -57,12 +57,6 @@ internal sealed class ConcreteClass2_SecondTest_TestSource_GUID : global::TUnit. }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.AbstractTests.ConcreteClass2(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.AbstractTests.ConcreteClass2)instance; - typedInstance.SecondTest(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.SecondTest(); @@ -145,11 +139,6 @@ internal sealed class ConcreteClass2_AssertClassName_TestSource_GUID : global::T }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.AbstractTests.ConcreteClass2(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.AbstractTests.ConcreteClass2)instance; - await typedInstance.AssertClassName(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.AssertClassName(); @@ -231,12 +220,6 @@ internal sealed class ConcreteClass2_SecondTest_TestSource_GUID : global::TUnit. }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.AbstractTests.ConcreteClass2(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.AbstractTests.ConcreteClass2)instance; - typedInstance.SecondTest(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.SecondTest(); @@ -318,11 +301,6 @@ internal sealed class ConcreteClass1_AssertClassName_TestSource_GUID : global::T }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.AbstractTests.ConcreteClass1(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.AbstractTests.ConcreteClass1)instance; - await typedInstance.AssertClassName(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.AssertClassName(); diff --git a/TUnit.Core.SourceGenerator.Tests/InheritsTestsTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/InheritsTestsTests.Test.verified.txt index 8e30925753..0a21ea45d1 100644 --- a/TUnit.Core.SourceGenerator.Tests/InheritsTestsTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/InheritsTestsTests.Test.verified.txt @@ -117,18 +117,6 @@ internal sealed class BaseClass_Test_TestSource_GUID : global::TUnit.Core.Interf { Data = default!, }, - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.Bugs._1924.None.BaseClass)instance; - switch (args.Length) - { - case 1: - await typedInstance.Test(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -265,18 +253,6 @@ internal sealed class Tests_Test_TestSource_GUID : global::TUnit.Core.Interfaces { Data = default!, }, - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.Bugs._1924.None.Tests)instance; - switch (args.Length) - { - case 1: - await typedInstance.Test(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -413,18 +389,6 @@ internal sealed class Tests2_Test_TestSource_GUID : global::TUnit.Core.Interface { Data = default!, }, - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.Bugs._1924.None.Tests2)instance; - switch (args.Length) - { - case 1: - await typedInstance.Test(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -561,18 +525,6 @@ internal sealed class Tests3_Test_TestSource_GUID : global::TUnit.Core.Interface { Data = default!, }, - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.Bugs._1924.None.Tests3)instance; - switch (args.Length) - { - case 1: - await typedInstance.Test(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) diff --git a/TUnit.Core.SourceGenerator.Tests/Issue2887Tests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Issue2887Tests.Test.verified.txt index 018a61c584..ec57a335b7 100644 --- a/TUnit.Core.SourceGenerator.Tests/Issue2887Tests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Issue2887Tests.Test.verified.txt @@ -69,12 +69,6 @@ internal sealed class ActualTestClass_Test1_TestSource_GUID : global::TUnit.Core // ClassConstructor attribute is present - instance creation handled at runtime throw new global::System.NotSupportedException("Instance creation for classes with ClassConstructor attribute is handled at runtime"); }, - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.Bugs._Issue2887.ActualTestClass)instance; - typedInstance.Test1(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.Test1(); diff --git a/TUnit.Core.SourceGenerator.Tests/MatrixTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/MatrixTests.Test.verified.txt index 2d9962b5a1..a064107592 100644 --- a/TUnit.Core.SourceGenerator.Tests/MatrixTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/MatrixTests.Test.verified.txt @@ -82,18 +82,6 @@ internal sealed class MatrixTests_MatrixTest_One_TestSource_GUID : global::TUnit }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.MatrixTests)instance; - switch (args.Length) - { - case 3: - await typedInstance.MatrixTest_One(TUnit.Core.Helpers.CastHelper.Cast(args[0]), TUnit.Core.Helpers.CastHelper.Cast(args[1]), TUnit.Core.Helpers.CastHelper.Cast(args[2])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -214,18 +202,6 @@ internal sealed class MatrixTests_MatrixTest_Two_TestSource_GUID : global::TUnit }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.MatrixTests)instance; - switch (args.Length) - { - case 4: - await typedInstance.MatrixTest_Two(TUnit.Core.Helpers.CastHelper.Cast(args[0]), TUnit.Core.Helpers.CastHelper.Cast(args[1]), TUnit.Core.Helpers.CastHelper.Cast(args[2]), TUnit.Core.Helpers.CastHelper.Cast(args[3])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 4 arguments, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -339,18 +315,6 @@ internal sealed class MatrixTests_MatrixTest_Enum_TestSource_GUID : global::TUni }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.MatrixTests)instance; - switch (args.Length) - { - case 3: - await typedInstance.MatrixTest_Enum(TUnit.Core.Helpers.CastHelper.Cast(args[0]), TUnit.Core.Helpers.CastHelper.Cast(args[1]), TUnit.Core.Helpers.CastHelper.Cast(args[2])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -457,18 +421,6 @@ internal sealed class MatrixTests_AutoGenerateBools_TestSource_GUID : global::TU }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.MatrixTests)instance; - switch (args.Length) - { - case 2: - await typedInstance.AutoGenerateBools(TUnit.Core.Helpers.CastHelper.Cast(args[0]), TUnit.Core.Helpers.CastHelper.Cast(args[1])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -575,18 +527,6 @@ internal sealed class MatrixTests_AutoGenerateBools2_TestSource_GUID : global::T }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.MatrixTests)instance; - switch (args.Length) - { - case 2: - await typedInstance.AutoGenerateBools2(TUnit.Core.Helpers.CastHelper.Cast(args[0]), TUnit.Core.Helpers.CastHelper.Cast(args[1])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -693,18 +633,6 @@ internal sealed class MatrixTests_ImplicitConversion_TestSource_GUID : global::T }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.MatrixTests)instance; - switch (args.Length) - { - case 2: - await typedInstance.ImplicitConversion(TUnit.Core.Helpers.CastHelper.Cast>(args[0]), TUnit.Core.Helpers.CastHelper.Cast(args[1])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -811,18 +739,6 @@ internal sealed class MatrixTests_ExcludingAutoGeneratedMatrixValues_TestSource_ }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.MatrixTests)instance; - switch (args.Length) - { - case 2: - await typedInstance.ExcludingAutoGeneratedMatrixValues(TUnit.Core.Helpers.CastHelper.Cast(args[0]), TUnit.Core.Helpers.CastHelper.Cast(args[1])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -922,18 +838,6 @@ internal sealed class MatrixTests_Method1_TestSource_GUID : global::TUnit.Core.I }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.MatrixTests)instance; - switch (args.Length) - { - case 1: - await typedInstance.Method1(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -1033,18 +937,6 @@ internal sealed class MatrixTests_Method2_TestSource_GUID : global::TUnit.Core.I }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.MatrixTests)instance; - switch (args.Length) - { - case 1: - await typedInstance.Method2(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -1144,18 +1036,6 @@ internal sealed class MatrixTests_Method3_TestSource_GUID : global::TUnit.Core.I }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.MatrixTests)instance; - switch (args.Length) - { - case 1: - await typedInstance.Method3(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -1255,18 +1135,6 @@ internal sealed class MatrixTests_Method4_TestSource_GUID : global::TUnit.Core.I }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.MatrixTests)instance; - switch (args.Length) - { - case 1: - await typedInstance.Method4(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -1376,18 +1244,6 @@ internal sealed class MatrixTests_Exclusion_TestSource_GUID : global::TUnit.Core }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.MatrixTests)instance; - switch (args.Length) - { - case 2: - await typedInstance.Exclusion(TUnit.Core.Helpers.CastHelper.Cast(args[0]), TUnit.Core.Helpers.CastHelper.Cast(args[1])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) diff --git a/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenTests.Test.verified.txt index 0a2f909478..aa7de54224 100644 --- a/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenTests.Test.verified.txt @@ -79,19 +79,6 @@ internal sealed class MethodDataSourceDrivenTests_DataSource_Method_TestSource_G }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.MethodDataSourceDrivenTests)instance; - switch (args.Length) - { - case 1: - typedInstance.DataSource_Method(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -203,19 +190,6 @@ internal sealed class MethodDataSourceDrivenTests_DataSource_Method2_TestSource_ }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.MethodDataSourceDrivenTests)instance; - switch (args.Length) - { - case 1: - typedInstance.DataSource_Method2(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -327,19 +301,6 @@ internal sealed class MethodDataSourceDrivenTests_DataSource_Method_WithAction_T }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.MethodDataSourceDrivenTests)instance; - switch (args.Length) - { - case 1: - typedInstance.DataSource_Method_WithAction(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -466,19 +427,6 @@ internal sealed class MethodDataSourceDrivenTests_DataSource_Method3_TestSource_ }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.MethodDataSourceDrivenTests)instance; - switch (args.Length) - { - case 1: - typedInstance.DataSource_Method3(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -632,19 +580,6 @@ internal sealed class MethodDataSourceDrivenTests_DataSource_Method4_TestSource_ }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.MethodDataSourceDrivenTests)instance; - switch (args.Length) - { - case 1: - typedInstance.DataSource_Method4(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -756,19 +691,6 @@ internal sealed class MethodDataSourceDrivenTests_DataSource_WithBaseReturn_Test }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.MethodDataSourceDrivenTests)instance; - switch (args.Length) - { - case 1: - typedInstance.DataSource_WithBaseReturn(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -890,18 +812,6 @@ internal sealed class MethodDataSourceDrivenTests_EnumerableFuncArrayTest_TestSo }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.MethodDataSourceDrivenTests)instance; - switch (args.Length) - { - case 1: - await typedInstance.EnumerableFuncArrayTest(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) diff --git a/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenWithCancellationTokenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenWithCancellationTokenTests.Test.verified.txt index 89d8a5cbd9..cdb3bc25bd 100644 --- a/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenWithCancellationTokenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenWithCancellationTokenTests.Test.verified.txt @@ -187,20 +187,6 @@ internal sealed class MethodDataSourceDrivenWithCancellationTokenTests_MyTest_Te }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests)instance; - var context = global::TUnit.Core.TestContext.Current; - switch (args.Length) - { - case 1: - typedInstance.MyTest(TUnit.Core.Helpers.CastHelper.Cast(args[0]), context?.CancellationToken ?? System.Threading.CancellationToken.None); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { var context = global::TUnit.Core.TestContext.Current; diff --git a/TUnit.Core.SourceGenerator.Tests/MultipleClassDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/MultipleClassDataSourceDrivenTests.Test.verified.txt index 729364453c..6f7dda8988 100644 --- a/TUnit.Core.SourceGenerator.Tests/MultipleClassDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/MultipleClassDataSourceDrivenTests.Test.verified.txt @@ -102,12 +102,6 @@ internal sealed class MultipleClassDataSourceDrivenTests_Test1_TestSource_GUID : { return new global::TUnit.TestProject.MultipleClassDataSourceDrivenTests(TUnit.Core.Helpers.CastHelper.Cast(args[0]), TUnit.Core.Helpers.CastHelper.Cast(args[1]), TUnit.Core.Helpers.CastHelper.Cast(args[2]), TUnit.Core.Helpers.CastHelper.Cast(args[3]), TUnit.Core.Helpers.CastHelper.Cast(args[4])); }, - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.MultipleClassDataSourceDrivenTests)instance; - typedInstance.Test1(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.Test1(); @@ -235,12 +229,6 @@ internal sealed class MultipleClassDataSourceDrivenTests_Test2_TestSource_GUID : { return new global::TUnit.TestProject.MultipleClassDataSourceDrivenTests(TUnit.Core.Helpers.CastHelper.Cast(args[0]), TUnit.Core.Helpers.CastHelper.Cast(args[1]), TUnit.Core.Helpers.CastHelper.Cast(args[2]), TUnit.Core.Helpers.CastHelper.Cast(args[3]), TUnit.Core.Helpers.CastHelper.Cast(args[4])); }, - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.MultipleClassDataSourceDrivenTests)instance; - typedInstance.Test2(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.Test2(); diff --git a/TUnit.Core.SourceGenerator.Tests/NameOfArgumentTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/NameOfArgumentTests.Test.verified.txt index 9e6c152647..8fdc13c02e 100644 --- a/TUnit.Core.SourceGenerator.Tests/NameOfArgumentTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/NameOfArgumentTests.Test.verified.txt @@ -68,18 +68,6 @@ internal sealed class NameOfArgumentTests_TestName_TestSource_GUID : global::TUn }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.NameOfArgumentTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.NameOfArgumentTests)instance; - switch (args.Length) - { - case 1: - await typedInstance.TestName(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) diff --git a/TUnit.Core.SourceGenerator.Tests/NullableByteArgumentTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/NullableByteArgumentTests.Test.verified.txt index 9378d83854..3d8b6fc137 100644 --- a/TUnit.Core.SourceGenerator.Tests/NullableByteArgumentTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/NullableByteArgumentTests.Test.verified.txt @@ -69,19 +69,6 @@ internal sealed class NullableByteArgumentTests_Test_TestSource_GUID : global::T }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.NullableByteArgumentTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.NullableByteArgumentTests)instance; - switch (args.Length) - { - case 1: - typedInstance.Test(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -190,19 +177,6 @@ internal sealed class NullableByteArgumentTests_Test2_TestSource_GUID : global:: }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.NullableByteArgumentTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.NullableByteArgumentTests)instance; - switch (args.Length) - { - case 2: - typedInstance.Test2(TUnit.Core.Helpers.CastHelper.Cast(args[0]), TUnit.Core.Helpers.CastHelper.Cast(args[1])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) diff --git a/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.Test.verified.txt index d0e118c78a..7815d0a5a6 100644 --- a/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.Test.verified.txt @@ -68,19 +68,6 @@ internal sealed class NumberArgumentTests_Int_TestSource_GUID : global::TUnit.Co }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.NumberArgumentTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.NumberArgumentTests)instance; - switch (args.Length) - { - case 1: - typedInstance.Int(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -181,19 +168,6 @@ internal sealed class NumberArgumentTests_Double_TestSource_GUID : global::TUnit }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.NumberArgumentTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.NumberArgumentTests)instance; - switch (args.Length) - { - case 1: - typedInstance.Double(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -294,19 +268,6 @@ internal sealed class NumberArgumentTests_Float_TestSource_GUID : global::TUnit. }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.NumberArgumentTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.NumberArgumentTests)instance; - switch (args.Length) - { - case 1: - typedInstance.Float(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -407,19 +368,6 @@ internal sealed class NumberArgumentTests_Long_TestSource_GUID : global::TUnit.C }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.NumberArgumentTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.NumberArgumentTests)instance; - switch (args.Length) - { - case 1: - typedInstance.Long(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -520,19 +468,6 @@ internal sealed class NumberArgumentTests_ULong_TestSource_GUID : global::TUnit. }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.NumberArgumentTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.NumberArgumentTests)instance; - switch (args.Length) - { - case 1: - typedInstance.ULong(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -633,19 +568,6 @@ internal sealed class NumberArgumentTests_UInt_TestSource_GUID : global::TUnit.C }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.NumberArgumentTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.NumberArgumentTests)instance; - switch (args.Length) - { - case 1: - typedInstance.UInt(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) diff --git a/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.TestDE.verified.txt b/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.TestDE.verified.txt index d0e118c78a..7815d0a5a6 100644 --- a/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.TestDE.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.TestDE.verified.txt @@ -68,19 +68,6 @@ internal sealed class NumberArgumentTests_Int_TestSource_GUID : global::TUnit.Co }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.NumberArgumentTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.NumberArgumentTests)instance; - switch (args.Length) - { - case 1: - typedInstance.Int(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -181,19 +168,6 @@ internal sealed class NumberArgumentTests_Double_TestSource_GUID : global::TUnit }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.NumberArgumentTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.NumberArgumentTests)instance; - switch (args.Length) - { - case 1: - typedInstance.Double(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -294,19 +268,6 @@ internal sealed class NumberArgumentTests_Float_TestSource_GUID : global::TUnit. }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.NumberArgumentTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.NumberArgumentTests)instance; - switch (args.Length) - { - case 1: - typedInstance.Float(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -407,19 +368,6 @@ internal sealed class NumberArgumentTests_Long_TestSource_GUID : global::TUnit.C }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.NumberArgumentTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.NumberArgumentTests)instance; - switch (args.Length) - { - case 1: - typedInstance.Long(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -520,19 +468,6 @@ internal sealed class NumberArgumentTests_ULong_TestSource_GUID : global::TUnit. }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.NumberArgumentTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.NumberArgumentTests)instance; - switch (args.Length) - { - case 1: - typedInstance.ULong(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -633,19 +568,6 @@ internal sealed class NumberArgumentTests_UInt_TestSource_GUID : global::TUnit.C }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.NumberArgumentTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.NumberArgumentTests)instance; - switch (args.Length) - { - case 1: - typedInstance.UInt(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) diff --git a/TUnit.Core.SourceGenerator.Tests/PriorityFilteringTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/PriorityFilteringTests.Test.verified.txt index 4b30a7131d..f777852322 100644 --- a/TUnit.Core.SourceGenerator.Tests/PriorityFilteringTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/PriorityFilteringTests.Test.verified.txt @@ -56,11 +56,6 @@ internal sealed class PriorityFilteringTests_High_1_TestSource_GUID : global::TU }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.PriorityFilteringTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.PriorityFilteringTests)instance; - await typedInstance.High_1(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.High_1(); @@ -141,11 +136,6 @@ internal sealed class PriorityFilteringTests_High_2_TestSource_GUID : global::TU }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.PriorityFilteringTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.PriorityFilteringTests)instance; - await typedInstance.High_2(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.High_2(); @@ -226,11 +216,6 @@ internal sealed class PriorityFilteringTests_High_3_TestSource_GUID : global::TU }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.PriorityFilteringTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.PriorityFilteringTests)instance; - await typedInstance.High_3(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.High_3(); @@ -311,11 +296,6 @@ internal sealed class PriorityFilteringTests_Medium_1_TestSource_GUID : global:: }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.PriorityFilteringTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.PriorityFilteringTests)instance; - await typedInstance.Medium_1(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.Medium_1(); @@ -396,11 +376,6 @@ internal sealed class PriorityFilteringTests_Medium_2_TestSource_GUID : global:: }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.PriorityFilteringTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.PriorityFilteringTests)instance; - await typedInstance.Medium_2(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.Medium_2(); @@ -481,11 +456,6 @@ internal sealed class PriorityFilteringTests_Low_1_TestSource_GUID : global::TUn }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.PriorityFilteringTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.PriorityFilteringTests)instance; - await typedInstance.Low_1(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.Low_1(); diff --git a/TUnit.Core.SourceGenerator.Tests/PropertySetterTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/PropertySetterTests.Test.verified.txt index 75ecdf210e..212372cf2e 100644 --- a/TUnit.Core.SourceGenerator.Tests/PropertySetterTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/PropertySetterTests.Test.verified.txt @@ -320,11 +320,6 @@ internal sealed class PropertySetterTests_Test_TestSource_GUID : global::TUnit.C Property6 = default!, Property7 = default!, }, - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.PropertySetterTests)instance; - await typedInstance.Test(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.Test(); diff --git a/TUnit.Core.SourceGenerator.Tests/RepeatTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/RepeatTests.Test.verified.txt index aa7e36d71a..fa4337ba96 100644 --- a/TUnit.Core.SourceGenerator.Tests/RepeatTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/RepeatTests.Test.verified.txt @@ -58,12 +58,6 @@ internal sealed class RepeatTests_One_TestSource_GUID : global::TUnit.Core.Inter }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.RepeatTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.RepeatTests)instance; - typedInstance.One(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.One(); @@ -147,12 +141,6 @@ internal sealed class RepeatTests_Two_TestSource_GUID : global::TUnit.Core.Inter }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.RepeatTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.RepeatTests)instance; - typedInstance.Two(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.Two(); @@ -235,12 +223,6 @@ internal sealed class RepeatTests_Three_TestSource_GUID : global::TUnit.Core.Int }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.RepeatTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.RepeatTests)instance; - typedInstance.Three(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.Three(); diff --git a/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet8_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet8_0.verified.txt index ebbdebccc4..e7de14ae1d 100644 --- a/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet8_0.verified.txt @@ -60,11 +60,6 @@ internal sealed class STAThreadTests_With_STA_TestSource_GUID : global::TUnit.Co }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.STAThreadTests)instance; - await typedInstance.With_STA(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.With_STA(); @@ -148,11 +143,6 @@ internal sealed class STAThreadTests_Without_STA_TestSource_GUID : global::TUnit }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.STAThreadTests)instance; - await typedInstance.Without_STA(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.Without_STA(); @@ -237,11 +227,6 @@ internal sealed class STAThreadTests_STA_WithSimpleAwait_TestSource_GUID : globa }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.STAThreadTests)instance; - await typedInstance.STA_WithSimpleAwait(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.STA_WithSimpleAwait(); @@ -326,11 +311,6 @@ internal sealed class STAThreadTests_STA_WithTaskYield_TestSource_GUID : global: }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.STAThreadTests)instance; - await typedInstance.STA_WithTaskYield(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.STA_WithTaskYield(); @@ -415,11 +395,6 @@ internal sealed class STAThreadTests_STA_WithConfigureAwaitTrue_TestSource_GUID }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.STAThreadTests)instance; - await typedInstance.STA_WithConfigureAwaitTrue(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.STA_WithConfigureAwaitTrue(); @@ -504,11 +479,6 @@ internal sealed class STAThreadTests_STA_WithNestedAsyncCalls_TestSource_GUID : }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.STAThreadTests)instance; - await typedInstance.STA_WithNestedAsyncCalls(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.STA_WithNestedAsyncCalls(); @@ -593,11 +563,6 @@ internal sealed class STAThreadTests_STA_WithTaskFromResult_TestSource_GUID : gl }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.STAThreadTests)instance; - await typedInstance.STA_WithTaskFromResult(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.STA_WithTaskFromResult(); @@ -682,11 +647,6 @@ internal sealed class STAThreadTests_STA_WithCompletedTask_TestSource_GUID : glo }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.STAThreadTests)instance; - await typedInstance.STA_WithCompletedTask(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.STA_WithCompletedTask(); @@ -771,11 +731,6 @@ internal sealed class STAThreadTests_STA_WithTaskRun_TestSource_GUID : global::T }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.STAThreadTests)instance; - await typedInstance.STA_WithTaskRun(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.STA_WithTaskRun(); @@ -860,11 +815,6 @@ internal sealed class STAThreadTests_STA_WithMultipleAwaits_TestSource_GUID : gl }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.STAThreadTests)instance; - await typedInstance.STA_WithMultipleAwaits(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.STA_WithMultipleAwaits(); @@ -949,11 +899,6 @@ internal sealed class STAThreadTests_STA_WithAsyncEnumerable_TestSource_GUID : g }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.STAThreadTests)instance; - await typedInstance.STA_WithAsyncEnumerable(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.STA_WithAsyncEnumerable(); @@ -1038,11 +983,6 @@ internal sealed class STAThreadTests_STA_WithTaskWhenAll_TestSource_GUID : globa }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.STAThreadTests)instance; - await typedInstance.STA_WithTaskWhenAll(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.STA_WithTaskWhenAll(); @@ -1127,11 +1067,6 @@ internal sealed class STAThreadTests_STA_WithExceptionHandling_TestSource_GUID : }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.STAThreadTests)instance; - await typedInstance.STA_WithExceptionHandling(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.STA_WithExceptionHandling(); diff --git a/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet9_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet9_0.verified.txt index ebbdebccc4..e7de14ae1d 100644 --- a/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet9_0.verified.txt @@ -60,11 +60,6 @@ internal sealed class STAThreadTests_With_STA_TestSource_GUID : global::TUnit.Co }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.STAThreadTests)instance; - await typedInstance.With_STA(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.With_STA(); @@ -148,11 +143,6 @@ internal sealed class STAThreadTests_Without_STA_TestSource_GUID : global::TUnit }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.STAThreadTests)instance; - await typedInstance.Without_STA(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.Without_STA(); @@ -237,11 +227,6 @@ internal sealed class STAThreadTests_STA_WithSimpleAwait_TestSource_GUID : globa }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.STAThreadTests)instance; - await typedInstance.STA_WithSimpleAwait(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.STA_WithSimpleAwait(); @@ -326,11 +311,6 @@ internal sealed class STAThreadTests_STA_WithTaskYield_TestSource_GUID : global: }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.STAThreadTests)instance; - await typedInstance.STA_WithTaskYield(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.STA_WithTaskYield(); @@ -415,11 +395,6 @@ internal sealed class STAThreadTests_STA_WithConfigureAwaitTrue_TestSource_GUID }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.STAThreadTests)instance; - await typedInstance.STA_WithConfigureAwaitTrue(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.STA_WithConfigureAwaitTrue(); @@ -504,11 +479,6 @@ internal sealed class STAThreadTests_STA_WithNestedAsyncCalls_TestSource_GUID : }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.STAThreadTests)instance; - await typedInstance.STA_WithNestedAsyncCalls(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.STA_WithNestedAsyncCalls(); @@ -593,11 +563,6 @@ internal sealed class STAThreadTests_STA_WithTaskFromResult_TestSource_GUID : gl }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.STAThreadTests)instance; - await typedInstance.STA_WithTaskFromResult(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.STA_WithTaskFromResult(); @@ -682,11 +647,6 @@ internal sealed class STAThreadTests_STA_WithCompletedTask_TestSource_GUID : glo }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.STAThreadTests)instance; - await typedInstance.STA_WithCompletedTask(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.STA_WithCompletedTask(); @@ -771,11 +731,6 @@ internal sealed class STAThreadTests_STA_WithTaskRun_TestSource_GUID : global::T }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.STAThreadTests)instance; - await typedInstance.STA_WithTaskRun(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.STA_WithTaskRun(); @@ -860,11 +815,6 @@ internal sealed class STAThreadTests_STA_WithMultipleAwaits_TestSource_GUID : gl }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.STAThreadTests)instance; - await typedInstance.STA_WithMultipleAwaits(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.STA_WithMultipleAwaits(); @@ -949,11 +899,6 @@ internal sealed class STAThreadTests_STA_WithAsyncEnumerable_TestSource_GUID : g }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.STAThreadTests)instance; - await typedInstance.STA_WithAsyncEnumerable(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.STA_WithAsyncEnumerable(); @@ -1038,11 +983,6 @@ internal sealed class STAThreadTests_STA_WithTaskWhenAll_TestSource_GUID : globa }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.STAThreadTests)instance; - await typedInstance.STA_WithTaskWhenAll(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.STA_WithTaskWhenAll(); @@ -1127,11 +1067,6 @@ internal sealed class STAThreadTests_STA_WithExceptionHandling_TestSource_GUID : }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.STAThreadTests)instance; - await typedInstance.STA_WithExceptionHandling(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.STA_WithExceptionHandling(); diff --git a/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.Net4_7.verified.txt b/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.Net4_7.verified.txt index 40783cd350..daac7fea9d 100644 --- a/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.Net4_7.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.Net4_7.verified.txt @@ -60,11 +60,6 @@ internal sealed class STAThreadTests_With_STA_TestSource_GUID : global::TUnit.Co }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.STAThreadTests)instance; - await typedInstance.With_STA(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.With_STA(); @@ -148,11 +143,6 @@ internal sealed class STAThreadTests_Without_STA_TestSource_GUID : global::TUnit }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.STAThreadTests)instance; - await typedInstance.Without_STA(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.Without_STA(); @@ -237,11 +227,6 @@ internal sealed class STAThreadTests_STA_WithSimpleAwait_TestSource_GUID : globa }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.STAThreadTests)instance; - await typedInstance.STA_WithSimpleAwait(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.STA_WithSimpleAwait(); @@ -326,11 +311,6 @@ internal sealed class STAThreadTests_STA_WithTaskYield_TestSource_GUID : global: }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.STAThreadTests)instance; - await typedInstance.STA_WithTaskYield(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.STA_WithTaskYield(); @@ -415,11 +395,6 @@ internal sealed class STAThreadTests_STA_WithConfigureAwaitTrue_TestSource_GUID }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.STAThreadTests)instance; - await typedInstance.STA_WithConfigureAwaitTrue(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.STA_WithConfigureAwaitTrue(); @@ -504,11 +479,6 @@ internal sealed class STAThreadTests_STA_WithNestedAsyncCalls_TestSource_GUID : }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.STAThreadTests)instance; - await typedInstance.STA_WithNestedAsyncCalls(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.STA_WithNestedAsyncCalls(); @@ -593,11 +563,6 @@ internal sealed class STAThreadTests_STA_WithTaskFromResult_TestSource_GUID : gl }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.STAThreadTests)instance; - await typedInstance.STA_WithTaskFromResult(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.STA_WithTaskFromResult(); @@ -682,11 +647,6 @@ internal sealed class STAThreadTests_STA_WithCompletedTask_TestSource_GUID : glo }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.STAThreadTests)instance; - await typedInstance.STA_WithCompletedTask(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.STA_WithCompletedTask(); @@ -771,11 +731,6 @@ internal sealed class STAThreadTests_STA_WithTaskRun_TestSource_GUID : global::T }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.STAThreadTests)instance; - await typedInstance.STA_WithTaskRun(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.STA_WithTaskRun(); @@ -860,11 +815,6 @@ internal sealed class STAThreadTests_STA_WithMultipleAwaits_TestSource_GUID : gl }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.STAThreadTests)instance; - await typedInstance.STA_WithMultipleAwaits(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.STA_WithMultipleAwaits(); @@ -949,11 +899,6 @@ internal sealed class STAThreadTests_STA_WithAsyncEnumerable_TestSource_GUID : g }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.STAThreadTests)instance; - await typedInstance.STA_WithAsyncEnumerable(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.STA_WithAsyncEnumerable(); @@ -1038,11 +983,6 @@ internal sealed class STAThreadTests_STA_WithTaskWhenAll_TestSource_GUID : globa }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.STAThreadTests)instance; - await typedInstance.STA_WithTaskWhenAll(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.STA_WithTaskWhenAll(); @@ -1127,11 +1067,6 @@ internal sealed class STAThreadTests_STA_WithExceptionHandling_TestSource_GUID : }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.STAThreadTests)instance; - await typedInstance.STA_WithExceptionHandling(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.STA_WithExceptionHandling(); diff --git a/TUnit.Core.SourceGenerator.Tests/StringArgumentTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/StringArgumentTests.Test.verified.txt index b2ec37bb85..dfa532ae18 100644 --- a/TUnit.Core.SourceGenerator.Tests/StringArgumentTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/StringArgumentTests.Test.verified.txt @@ -79,19 +79,6 @@ internal sealed class StringArgumentTests_Normal_TestSource_GUID : global::TUnit }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.StringArgumentTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.StringArgumentTests)instance; - switch (args.Length) - { - case 1: - typedInstance.Normal(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -199,19 +186,6 @@ internal sealed class StringArgumentTests_Nullable_TestSource_GUID : global::TUn }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.StringArgumentTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.StringArgumentTests)instance; - switch (args.Length) - { - case 1: - typedInstance.Nullable(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) diff --git a/TUnit.Core.SourceGenerator.Tests/Tests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests.Test.verified.txt index 38860630b1..6f2c6714f4 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests.Test.verified.txt @@ -79,19 +79,6 @@ internal sealed class Tests_TryParse_InvalidString_ReturnsFailure_TestSource_GUI }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.Bugs._1304.Tests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.Bugs._1304.Tests)instance; - var context = global::TUnit.Core.TestContext.Current; - switch (args.Length) - { - case 1: - await typedInstance.TryParse_InvalidString_ReturnsFailure(TUnit.Core.Helpers.CastHelper.Cast(args[0]), context?.CancellationToken ?? System.Threading.CancellationToken.None); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { var context = global::TUnit.Core.TestContext.Current; @@ -196,18 +183,6 @@ internal sealed class Tests_Parse_InvalidString_ThrowsException_TestSource_GUID }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.Bugs._1304.Tests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.Bugs._1304.Tests)instance; - switch (args.Length) - { - case 1: - await typedInstance.Parse_InvalidString_ThrowsException(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -308,18 +283,6 @@ internal sealed class Tests_TryParse_ValidString_ReturnsAccountId_TestSource_GUI }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.Bugs._1304.Tests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.Bugs._1304.Tests)instance; - switch (args.Length) - { - case 1: - await typedInstance.TryParse_ValidString_ReturnsAccountId(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1538.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1538.Test.verified.txt index 3783d4bb34..746f66dcfa 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1538.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1538.Test.verified.txt @@ -138,19 +138,6 @@ internal sealed class Tests_Eight_Args_TestSource_GUID : global::TUnit.Core.Inte }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.Bugs._1538.Tests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.Bugs._1538.Tests)instance; - switch (args.Length) - { - case 8: - typedInstance.Eight_Args(TUnit.Core.Helpers.CastHelper.Cast(args[0]), TUnit.Core.Helpers.CastHelper.Cast(args[1]), TUnit.Core.Helpers.CastHelper.Cast(args[2]), TUnit.Core.Helpers.CastHelper.Cast(args[3]), TUnit.Core.Helpers.CastHelper.Cast(args[4]), TUnit.Core.Helpers.CastHelper.Cast(args[5]), TUnit.Core.Helpers.CastHelper.Cast(args[6]), TUnit.Core.Helpers.CastHelper.Cast(args[7])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 8 arguments, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -377,19 +364,6 @@ internal sealed class Tests_SixteenArgs_TestSource_GUID : global::TUnit.Core.Int }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.Bugs._1538.Tests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.Bugs._1538.Tests)instance; - switch (args.Length) - { - case 16: - typedInstance.SixteenArgs(TUnit.Core.Helpers.CastHelper.Cast(args[0]), TUnit.Core.Helpers.CastHelper.Cast(args[1]), TUnit.Core.Helpers.CastHelper.Cast(args[2]), TUnit.Core.Helpers.CastHelper.Cast(args[3]), TUnit.Core.Helpers.CastHelper.Cast(args[4]), TUnit.Core.Helpers.CastHelper.Cast(args[5]), TUnit.Core.Helpers.CastHelper.Cast(args[6]), TUnit.Core.Helpers.CastHelper.Cast(args[7]), TUnit.Core.Helpers.CastHelper.Cast(args[8]), TUnit.Core.Helpers.CastHelper.Cast(args[9]), TUnit.Core.Helpers.CastHelper.Cast(args[10]), TUnit.Core.Helpers.CastHelper.Cast(args[11]), TUnit.Core.Helpers.CastHelper.Cast(args[12]), TUnit.Core.Helpers.CastHelper.Cast(args[13]), TUnit.Core.Helpers.CastHelper.Cast(args[14]), TUnit.Core.Helpers.CastHelper.Cast(args[15])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 16 arguments, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1539.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1539.Test.verified.txt index b41e42f3be..7fcf9ce7dc 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1539.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1539.Test.verified.txt @@ -60,12 +60,6 @@ internal sealed class Tests_Test_TestSource_GUID : global::TUnit.Core.Interfaces }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.Bugs._1539.Tests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.Bugs._1539.Tests)instance; - typedInstance.Test(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.Test(); diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1589.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1589.Test.verified.txt index 16c923ae7e..7ea8f73b7f 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1589.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1589.Test.verified.txt @@ -74,11 +74,6 @@ internal sealed class MyTests_Test1_TestSource_GUID : global::TUnit.Core.Interfa { return new global::TUnit.TestProject.Bugs._1589.MyTests(TUnit.Core.Helpers.CastHelper.Cast(args[0])); }, - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.Bugs._1589.MyTests)instance; - await typedInstance.Test1(); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.Test1(); diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1594.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1594.Test.verified.txt index 9d55d59a47..4c18a7f1ed 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1594.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1594.Test.verified.txt @@ -74,12 +74,6 @@ internal sealed class MyTests_Test1_TestSource_GUID : global::TUnit.Core.Interfa { return new global::TUnit.TestProject.Bugs._1594.MyTests(TUnit.Core.Helpers.CastHelper.Cast(args[0])); }, - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.Bugs._1594.MyTests)instance; - typedInstance.Test1(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.Test1(); diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1603.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1603.Test.verified.txt index 14ed292e06..f740622440 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1603.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1603.Test.verified.txt @@ -68,18 +68,6 @@ internal sealed class Tests_Casted_Integer_To_Short_Converts_TestSource_GUID : g }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.Bugs._1603.Tests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.Bugs._1603.Tests)instance; - switch (args.Length) - { - case 1: - await typedInstance.Casted_Integer_To_Short_Converts(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -179,18 +167,6 @@ internal sealed class Tests_Integer_To_Short_Converts_TestSource_GUID : global:: }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.Bugs._1603.Tests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.Bugs._1603.Tests)instance; - switch (args.Length) - { - case 1: - await typedInstance.Integer_To_Short_Converts(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1692.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1692.Test.verified.txt index 8e90c3aaec..0762fad2fd 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1692.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1692.Test.verified.txt @@ -69,18 +69,6 @@ internal sealed class Tests_NullTest_TestSource_GUID : global::TUnit.Core.Interf }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.Bugs._1692.Tests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.Bugs._1692.Tests)instance; - switch (args.Length) - { - case 1: - await typedInstance.NullTest(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1821.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1821.Test.verified.txt index cc648fd9b3..ce751cac48 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1821.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1821.Test.verified.txt @@ -84,18 +84,6 @@ internal sealed class Tests_MethodDataSource_TestSource_GUID : global::TUnit.Cor { return new global::TUnit.TestProject.Bugs._1821.Tests(TUnit.Core.Helpers.CastHelper.Cast(args[0])); }, - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.Bugs._1821.Tests)instance; - switch (args.Length) - { - case 1: - await typedInstance.MethodDataSource(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -211,18 +199,6 @@ internal sealed class Tests_MatrixDataSource_TestSource_GUID : global::TUnit.Cor { return new global::TUnit.TestProject.Bugs._1821.Tests(TUnit.Core.Helpers.CastHelper.Cast(args[0])); }, - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.Bugs._1821.Tests)instance; - switch (args.Length) - { - case 1: - await typedInstance.MatrixDataSource(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.DotNet8_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.DotNet8_0.verified.txt index b0bd08ba83..24350fc30c 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.DotNet8_0.verified.txt @@ -57,12 +57,6 @@ internal sealed class DerivedTest_Test1_TestSource_GUID : global::TUnit.Core.Int }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.Bugs._1889.DerivedTest(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.Bugs._1889.DerivedTest)instance; - typedInstance.Test1(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.Test1(); @@ -157,19 +151,6 @@ internal sealed class DerivedTest_Test2_TestSource_GUID : global::TUnit.Core.Int }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.Bugs._1889.DerivedTest(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.Bugs._1889.DerivedTest)instance; - switch (args.Length) - { - case 1: - typedInstance.Test2(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -272,19 +253,6 @@ internal sealed class DerivedTest_Test3_TestSource_GUID : global::TUnit.Core.Int }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.Bugs._1889.DerivedTest(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.Bugs._1889.DerivedTest)instance; - switch (args.Length) - { - case 1: - typedInstance.Test3(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.DotNet9_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.DotNet9_0.verified.txt index b0bd08ba83..24350fc30c 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.DotNet9_0.verified.txt @@ -57,12 +57,6 @@ internal sealed class DerivedTest_Test1_TestSource_GUID : global::TUnit.Core.Int }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.Bugs._1889.DerivedTest(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.Bugs._1889.DerivedTest)instance; - typedInstance.Test1(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.Test1(); @@ -157,19 +151,6 @@ internal sealed class DerivedTest_Test2_TestSource_GUID : global::TUnit.Core.Int }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.Bugs._1889.DerivedTest(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.Bugs._1889.DerivedTest)instance; - switch (args.Length) - { - case 1: - typedInstance.Test2(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -272,19 +253,6 @@ internal sealed class DerivedTest_Test3_TestSource_GUID : global::TUnit.Core.Int }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.Bugs._1889.DerivedTest(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.Bugs._1889.DerivedTest)instance; - switch (args.Length) - { - case 1: - typedInstance.Test3(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.Net4_7.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.Net4_7.verified.txt index 98f643b6e5..27883b9835 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.Net4_7.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.Net4_7.verified.txt @@ -57,12 +57,6 @@ internal sealed class DerivedTest_Test1_TestSource_GUID : global::TUnit.Core.Int }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.Bugs._1889.DerivedTest(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.Bugs._1889.DerivedTest)instance; - typedInstance.Test1(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.Test1(); @@ -157,19 +151,6 @@ internal sealed class DerivedTest_Test2_TestSource_GUID : global::TUnit.Core.Int }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.Bugs._1889.DerivedTest(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.Bugs._1889.DerivedTest)instance; - switch (args.Length) - { - case 1: - typedInstance.Test2(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -272,19 +253,6 @@ internal sealed class DerivedTest_Test3_TestSource_GUID : global::TUnit.Core.Int }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.Bugs._1889.DerivedTest(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.Bugs._1889.DerivedTest)instance; - switch (args.Length) - { - case 1: - typedInstance.Test3(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1899.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1899.Test.verified.txt index 8b6b200cb4..d321a6b76d 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1899.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1899.Test.verified.txt @@ -57,12 +57,6 @@ internal sealed class DerivedTest_Test1_TestSource_GUID : global::TUnit.Core.Int }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.Bugs._1899.DerivedTest(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.Bugs._1899.DerivedTest)instance; - typedInstance.Test1(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.Test1(); diff --git a/TUnit.Core.SourceGenerator.Tests/Tests2083.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests2083.Test.verified.txt index 367b570fff..81faf945c7 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests2083.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests2083.Test.verified.txt @@ -73,19 +73,6 @@ internal sealed class Tests_MyTest_TestSource_GUID : global::TUnit.Core.Interfac }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.Bugs._2083.Tests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.Bugs._2083.Tests)instance; - switch (args.Length) - { - case 1: - typedInstance.MyTest(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) diff --git a/TUnit.Core.SourceGenerator.Tests/Tests2085.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests2085.Test.verified.txt index 4945406a04..642a9d67ee 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests2085.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests2085.Test.verified.txt @@ -68,18 +68,6 @@ internal sealed class Tests_Double_SpecialConsts_TestSource_GUID : global::TUnit }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.Bugs._2085.Tests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.Bugs._2085.Tests)instance; - switch (args.Length) - { - case 1: - await typedInstance.Double_SpecialConsts(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -179,18 +167,6 @@ internal sealed class Tests_Float_SpecialConsts_TestSource_GUID : global::TUnit. }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.Bugs._2085.Tests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.Bugs._2085.Tests)instance; - switch (args.Length) - { - case 1: - await typedInstance.Float_SpecialConsts(TUnit.Core.Helpers.CastHelper.Cast(args[0])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) diff --git a/TUnit.Core.SourceGenerator.Tests/Tests2112.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests2112.Test.verified.txt index c863aae48f..8b1ec469cf 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests2112.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests2112.Test.verified.txt @@ -76,37 +76,6 @@ internal sealed class Tests_Test_TestSource_GUID : global::TUnit.Core.Interfaces }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.Bugs._2112.Tests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.Bugs._2112.Tests)instance; - switch (args.Length) - { - case 1: - typedInstance.Test(TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[0]); - break; - case 2: - typedInstance.Test(TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[] { TUnit.Core.Helpers.CastHelper.Cast(args[1]) }); - break; - case 3: - typedInstance.Test(TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[] { TUnit.Core.Helpers.CastHelper.Cast(args[1]), TUnit.Core.Helpers.CastHelper.Cast(args[2]) }); - break; - case 4: - typedInstance.Test(TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[] { TUnit.Core.Helpers.CastHelper.Cast(args[1]), TUnit.Core.Helpers.CastHelper.Cast(args[2]), TUnit.Core.Helpers.CastHelper.Cast(args[3]) }); - break; - case 5: - typedInstance.Test(TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[] { TUnit.Core.Helpers.CastHelper.Cast(args[1]), TUnit.Core.Helpers.CastHelper.Cast(args[2]), TUnit.Core.Helpers.CastHelper.Cast(args[3]), TUnit.Core.Helpers.CastHelper.Cast(args[4]) }); - break; - case 6: - typedInstance.Test(TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[] { TUnit.Core.Helpers.CastHelper.Cast(args[1]), TUnit.Core.Helpers.CastHelper.Cast(args[2]), TUnit.Core.Helpers.CastHelper.Cast(args[3]), TUnit.Core.Helpers.CastHelper.Cast(args[4]), TUnit.Core.Helpers.CastHelper.Cast(args[5]) }); - break; - case 7: - typedInstance.Test(TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[] { TUnit.Core.Helpers.CastHelper.Cast(args[1]), TUnit.Core.Helpers.CastHelper.Cast(args[2]), TUnit.Core.Helpers.CastHelper.Cast(args[3]), TUnit.Core.Helpers.CastHelper.Cast(args[4]), TUnit.Core.Helpers.CastHelper.Cast(args[5]), TUnit.Core.Helpers.CastHelper.Cast(args[6]) }); - break; - default: - throw new global::System.ArgumentException($"Expected between 1 and 2 arguments, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) @@ -233,37 +202,6 @@ internal sealed class Tests_Test2_TestSource_GUID : global::TUnit.Core.Interface }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.Bugs._2112.Tests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.Bugs._2112.Tests)instance; - switch (args.Length) - { - case 1: - typedInstance.Test2(TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[0]); - break; - case 2: - typedInstance.Test2(TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[] { TUnit.Core.Helpers.CastHelper.Cast(args[1]) }); - break; - case 3: - typedInstance.Test2(TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[] { TUnit.Core.Helpers.CastHelper.Cast(args[1]), TUnit.Core.Helpers.CastHelper.Cast(args[2]) }); - break; - case 4: - typedInstance.Test2(TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[] { TUnit.Core.Helpers.CastHelper.Cast(args[1]), TUnit.Core.Helpers.CastHelper.Cast(args[2]), TUnit.Core.Helpers.CastHelper.Cast(args[3]) }); - break; - case 5: - typedInstance.Test2(TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[] { TUnit.Core.Helpers.CastHelper.Cast(args[1]), TUnit.Core.Helpers.CastHelper.Cast(args[2]), TUnit.Core.Helpers.CastHelper.Cast(args[3]), TUnit.Core.Helpers.CastHelper.Cast(args[4]) }); - break; - case 6: - typedInstance.Test2(TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[] { TUnit.Core.Helpers.CastHelper.Cast(args[1]), TUnit.Core.Helpers.CastHelper.Cast(args[2]), TUnit.Core.Helpers.CastHelper.Cast(args[3]), TUnit.Core.Helpers.CastHelper.Cast(args[4]), TUnit.Core.Helpers.CastHelper.Cast(args[5]) }); - break; - case 7: - typedInstance.Test2(TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[] { TUnit.Core.Helpers.CastHelper.Cast(args[1]), TUnit.Core.Helpers.CastHelper.Cast(args[2]), TUnit.Core.Helpers.CastHelper.Cast(args[3]), TUnit.Core.Helpers.CastHelper.Cast(args[4]), TUnit.Core.Helpers.CastHelper.Cast(args[5]), TUnit.Core.Helpers.CastHelper.Cast(args[6]) }); - break; - default: - throw new global::System.ArgumentException($"Expected between 1 and 2 arguments, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) diff --git a/TUnit.Core.SourceGenerator.Tests/Tests2136.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests2136.Test.verified.txt index 28f648c5b1..c9284e0fc0 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests2136.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests2136.Test.verified.txt @@ -76,45 +76,6 @@ internal sealed class Tests_GenericArgumentsTest_TestSource_GUID : global::TUnit { return new global::TUnit.TestProject.Bugs._2136.Tests(); }, - TestInvoker = async (instance, args) => - { - var instanceType = instance.GetType(); - var method = instanceType.GetMethod("GenericArgumentsTest", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.Instance); - if (method == null) - { - throw new global::System.InvalidOperationException($"Method 'GenericArgumentsTest' not found on type {instanceType.FullName}"); - } - // Make the method generic if it has type parameters - if (method.IsGenericMethodDefinition) - { - // Use the resolved generic types from the test context - var testContext = global::TUnit.Core.TestContext.Current; - var resolvedTypes = testContext?.TestDetails?.MethodGenericArguments; - if (resolvedTypes != null && resolvedTypes.Length > 0) - { - // Use the pre-resolved generic types - method = method.MakeGenericMethod(resolvedTypes); - } - else - { - // Fallback: infer type arguments from the actual argument types - var typeArgs = new global::System.Type[1]; - for (int i = 0; i < typeArgs.Length && i < args.Length; i++) - { - typeArgs[i] = args[i]?.GetType() ?? typeof(object); - } - method = method.MakeGenericMethod(typeArgs); - } - } - var methodArgs = new object?[args.Length]; - args.CopyTo(methodArgs, 0); - // Invoke the method - var result = method.Invoke(instance, methodArgs); - if (result is global::System.Threading.Tasks.Task task) - { - await task; - } - }, ConcreteInstantiations = new global::System.Collections.Generic.Dictionary { [(typeof(bool).FullName ?? typeof(bool).Name)] = diff --git a/TUnit.Core.SourceGenerator.Tests/TimeoutCancellationTokenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/TimeoutCancellationTokenTests.Test.verified.txt index 35aab20568..4e28c1f411 100644 --- a/TUnit.Core.SourceGenerator.Tests/TimeoutCancellationTokenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/TimeoutCancellationTokenTests.Test.verified.txt @@ -103,12 +103,6 @@ internal sealed class TimeoutCancellationTokenTests_DefaultTest_TestSource_GUID { return new global::TUnit.TestProject.TimeoutCancellationTokenTests(TUnit.Core.Helpers.CastHelper.Cast(args[0])); }, - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.TimeoutCancellationTokenTests)instance; - var context = global::TUnit.Core.TestContext.Current; - await typedInstance.DefaultTest(context?.CancellationToken ?? System.Threading.CancellationToken.None); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.DefaultTest(cancellationToken); @@ -238,12 +232,6 @@ internal sealed class TimeoutCancellationTokenTests_BasicTest_TestSource_GUID : { return new global::TUnit.TestProject.TimeoutCancellationTokenTests(TUnit.Core.Helpers.CastHelper.Cast(args[0])); }, - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.TimeoutCancellationTokenTests)instance; - var context = global::TUnit.Core.TestContext.Current; - await typedInstance.BasicTest(context?.CancellationToken ?? System.Threading.CancellationToken.None); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.BasicTest(cancellationToken); @@ -372,12 +360,6 @@ internal sealed class TimeoutCancellationTokenTests_InheritedTimeoutAttribute_Te { return new global::TUnit.TestProject.TimeoutCancellationTokenTests(TUnit.Core.Helpers.CastHelper.Cast(args[0])); }, - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.TimeoutCancellationTokenTests)instance; - var context = global::TUnit.Core.TestContext.Current; - await typedInstance.InheritedTimeoutAttribute(context?.CancellationToken ?? System.Threading.CancellationToken.None); - }, InvokeTypedTest = async (instance, args, cancellationToken) => { await instance.InheritedTimeoutAttribute(cancellationToken); @@ -516,19 +498,6 @@ internal sealed class TimeoutCancellationTokenTests_DataTest_TestSource_GUID : g { return new global::TUnit.TestProject.TimeoutCancellationTokenTests(TUnit.Core.Helpers.CastHelper.Cast(args[0])); }, - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.TimeoutCancellationTokenTests)instance; - var context = global::TUnit.Core.TestContext.Current; - switch (args.Length) - { - case 1: - await typedInstance.DataTest(TUnit.Core.Helpers.CastHelper.Cast(args[0]), context?.CancellationToken ?? System.Threading.CancellationToken.None); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { var context = global::TUnit.Core.TestContext.Current; @@ -696,19 +665,6 @@ internal sealed class TimeoutCancellationTokenTests_DataSourceTest_TestSource_GU { return new global::TUnit.TestProject.TimeoutCancellationTokenTests(TUnit.Core.Helpers.CastHelper.Cast(args[0])); }, - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.TimeoutCancellationTokenTests)instance; - var context = global::TUnit.Core.TestContext.Current; - switch (args.Length) - { - case 1: - await typedInstance.DataSourceTest(TUnit.Core.Helpers.CastHelper.Cast(args[0]), context?.CancellationToken ?? System.Threading.CancellationToken.None); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { var context = global::TUnit.Core.TestContext.Current; @@ -856,19 +812,6 @@ internal sealed class TimeoutCancellationTokenTests_MatrixTest_TestSource_GUID : { return new global::TUnit.TestProject.TimeoutCancellationTokenTests(TUnit.Core.Helpers.CastHelper.Cast(args[0])); }, - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.TimeoutCancellationTokenTests)instance; - var context = global::TUnit.Core.TestContext.Current; - switch (args.Length) - { - case 1: - await typedInstance.MatrixTest(TUnit.Core.Helpers.CastHelper.Cast(args[0]), context?.CancellationToken ?? System.Threading.CancellationToken.None); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - }, InvokeTypedTest = async (instance, args, cancellationToken) => { var context = global::TUnit.Core.TestContext.Current; diff --git a/TUnit.Core.SourceGenerator.Tests/TupleDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/TupleDataSourceDrivenTests.Test.verified.txt index 5d7f6925e1..eb661f24ad 100644 --- a/TUnit.Core.SourceGenerator.Tests/TupleDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/TupleDataSourceDrivenTests.Test.verified.txt @@ -93,19 +93,6 @@ internal sealed class TupleDataSourceDrivenTests_DataSource_TupleMethod_TestSour }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.TupleDataSourceDrivenTests(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.TupleDataSourceDrivenTests)instance; - switch (args.Length) - { - case 3: - typedInstance.DataSource_TupleMethod(TUnit.Core.Helpers.CastHelper.Cast(args[0]), TUnit.Core.Helpers.CastHelper.Cast(args[1]), TUnit.Core.Helpers.CastHelper.Cast(args[2])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) diff --git a/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_AotSafeDataSourceFactories.verified.txt b/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_AotSafeDataSourceFactories.verified.txt index 19c576e293..92691a0506 100644 --- a/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_AotSafeDataSourceFactories.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_AotSafeDataSourceFactories.verified.txt @@ -82,19 +82,6 @@ internal sealed class AotDataSourceTest_TestWithDataSource_TestSource_GUID : glo }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.AotDataSourceTest(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.AotDataSourceTest)instance; - switch (args.Length) - { - case 3: - typedInstance.TestWithDataSource(TUnit.Core.Helpers.CastHelper.Cast(args[0]), TUnit.Core.Helpers.CastHelper.Cast(args[1]), TUnit.Core.Helpers.CastHelper.Cast(args[2])); - break; - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { switch (args.Length) diff --git a/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_ConfigurationSupport.verified.txt b/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_ConfigurationSupport.verified.txt index 2d385a0c05..da458420d2 100644 --- a/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_ConfigurationSupport.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_ConfigurationSupport.verified.txt @@ -55,12 +55,6 @@ internal sealed class ConfigurationTest_TestWithConfiguration_TestSource_GUID : }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.ConfigurationTest(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.ConfigurationTest)instance; - typedInstance.TestWithConfiguration(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.TestWithConfiguration(); diff --git a/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_ModuleInitializer_Generation.verified.txt b/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_ModuleInitializer_Generation.verified.txt index 1d6cdab47e..d932255add 100644 --- a/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_ModuleInitializer_Generation.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_ModuleInitializer_Generation.verified.txt @@ -55,12 +55,6 @@ internal sealed class ModuleInitializerTest_TestWithModuleInit_TestSource_GUID : }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.ModuleInitializerTest(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.ModuleInitializerTest)instance; - typedInstance.TestWithModuleInit(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.TestWithModuleInit(); diff --git a/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_StronglyTypedDelegates_Generation.verified.txt b/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_StronglyTypedDelegates_Generation.verified.txt index c3a52f2e1c..f59167a47e 100644 --- a/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_StronglyTypedDelegates_Generation.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_StronglyTypedDelegates_Generation.verified.txt @@ -55,12 +55,6 @@ internal sealed class TypedDelegateTest_TestWithDelegate_TestSource_GUID : globa }) }, InstanceFactory = (typeArgs, args) => new global::TUnit.TestProject.TypedDelegateTest(), - TestInvoker = async (instance, args) => - { - var typedInstance = (global::TUnit.TestProject.TypedDelegateTest)instance; - typedInstance.TestWithDelegate(); - await global::System.Threading.Tasks.Task.CompletedTask; - }, InvokeTypedTest = async (instance, args, cancellationToken) => { instance.TestWithDelegate(); diff --git a/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs b/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs index 178dc8bcd8..c620f96855 100644 --- a/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs +++ b/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs @@ -1807,251 +1807,18 @@ private static void GenerateTypedInvokers(CodeWriter writer, TestMethodMetadata // Use centralized instance factory generator for all types (generic and non-generic) InstanceFactoryGenerator.GenerateInstanceFactory(writer, testMethod.TypeSymbol, testMethod); - // For generic types or methods, we need to use reflection to invoke the test method + // Generate InvokeTypedTest for non-generic tests var isAsync = IsAsyncMethod(testMethod.MethodSymbol); - if (testMethod.IsGenericType || testMethod.IsGenericMethod) - { - GenerateGenericTestInvoker(writer, testMethod, methodName, isAsync, hasCancellationToken, parametersFromArgs); - } - else + if (!testMethod.IsGenericType && !testMethod.IsGenericMethod) { GenerateConcreteTestInvoker(writer, testMethod, className, methodName, isAsync, hasCancellationToken, parametersFromArgs); } } - - private static void GenerateGenericTestInvoker(CodeWriter writer, TestMethodMetadata testMethod, string methodName, bool isAsync, bool hasCancellationToken, IParameterSymbol[] parametersFromArgs) - { - writer.AppendLine("TestInvoker = async (instance, args) =>"); - writer.AppendLine("{"); - writer.Indent(); - - // Use reflection to invoke the method on the generic type instance - writer.AppendLine("var instanceType = instance.GetType();"); - writer.AppendLine($"var method = instanceType.GetMethod(\"{methodName}\", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.Instance);"); - writer.AppendLine("if (method == null)"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendLine($"throw new global::System.InvalidOperationException($\"Method '{methodName}' not found on type {{instanceType.FullName}}\");"); - writer.Unindent(); - writer.AppendLine("}"); - writer.AppendLine(); - - // Handle generic method case - if (testMethod is { IsGenericMethod: true, MethodSymbol.TypeParameters.Length: > 0 }) - { - writer.AppendLine("// Make the method generic if it has type parameters"); - writer.AppendLine("if (method.IsGenericMethodDefinition)"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendLine("// Use the resolved generic types from the test context"); - writer.AppendLine("var testContext = global::TUnit.Core.TestContext.Current;"); - writer.AppendLine("var resolvedTypes = testContext?.TestDetails?.MethodGenericArguments;"); - writer.AppendLine(); - writer.AppendLine("if (resolvedTypes != null && resolvedTypes.Length > 0)"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendLine("// Use the pre-resolved generic types"); - writer.AppendLine("method = method.MakeGenericMethod(resolvedTypes);"); - writer.Unindent(); - writer.AppendLine("}"); - writer.AppendLine("else"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendLine("// Fallback: infer type arguments from the actual argument types"); - writer.AppendLine("var typeArgs = new global::System.Type[" + testMethod.MethodSymbol.TypeParameters.Length + "];"); - writer.AppendLine("for (int i = 0; i < typeArgs.Length && i < args.Length; i++)"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendLine("typeArgs[i] = args[i]?.GetType() ?? typeof(object);"); - writer.Unindent(); - writer.AppendLine("}"); - writer.AppendLine("method = method.MakeGenericMethod(typeArgs);"); - writer.Unindent(); - writer.AppendLine("}"); - writer.Unindent(); - writer.AppendLine("}"); - writer.AppendLine(); - } - -writer.AppendLine("var methodArgs = new object?[args.Length" + (hasCancellationToken ? " + 1" : "") + "];"); - writer.AppendLine("args.CopyTo(methodArgs, 0);"); - - if (hasCancellationToken) - { - writer.AppendLine("methodArgs[args.Length] = global::TUnit.Core.TestContext.Current?.CancellationToken ?? global::System.Threading.CancellationToken.None;"); - } - - writer.AppendLine(); - writer.AppendLine("// Invoke the method"); - writer.AppendLine("var result = method.Invoke(instance, methodArgs);"); - - if (isAsync) - { - writer.AppendLine("if (result is global::System.Threading.Tasks.Task task)"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendLine("await task;"); - writer.Unindent(); - writer.AppendLine("}"); - } - - writer.Unindent(); - writer.AppendLine("},"); - } - private static void GenerateConcreteTestInvoker(CodeWriter writer, TestMethodMetadata testMethod, string className, string methodName, bool isAsync, bool hasCancellationToken, IParameterSymbol[] parametersFromArgs) { - writer.AppendLine("TestInvoker = async (instance, args) =>"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendLine($"var typedInstance = ({className})instance;"); - - // Only declare context if it's needed (when hasCancellationToken is true) - if (hasCancellationToken) - { - writer.AppendLine("var context = global::TUnit.Core.TestContext.Current;"); - } - - // Special case: Single tuple parameter - // If we have exactly one parameter that's a tuple type, we need to handle it specially - // In source-generated mode, tuples are always unwrapped into their elements - if (parametersFromArgs.Length == 1 && parametersFromArgs[0].Type is INamedTypeSymbol { IsTupleType: true } tupleType) - { - writer.AppendLine("// Special handling for single tuple parameter"); - writer.AppendLine($"if (args.Length == {tupleType.TupleElements.Length})"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendLine("// Arguments are unwrapped tuple elements, reconstruct the tuple"); - - // Build tuple reconstruction - var tupleConstruction = $"({string.Join(", ", tupleType.TupleElements.Select((_, i) => $"({tupleType.TupleElements[i].Type.GloballyQualified()})args[{i}]"))})"; - - var methodCallReconstructed = hasCancellationToken - ? $"typedInstance.{methodName}({tupleConstruction}, context?.CancellationToken ?? System.Threading.CancellationToken.None)" - : $"typedInstance.{methodName}({tupleConstruction})"; - if (isAsync) - { - writer.AppendLine($"await {methodCallReconstructed};"); - } - else - { - writer.AppendLine($"{methodCallReconstructed};"); - } - writer.Unindent(); - writer.AppendLine("}"); - writer.AppendLine("else if (args.Length == 1 && global::TUnit.Core.Helpers.DataSourceHelpers.IsTuple(args[0]))"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendLine("// Rare case: tuple is wrapped as a single argument"); - var methodCallDirect = hasCancellationToken - ? $"typedInstance.{methodName}(({tupleType.GloballyQualified()})args[0], context?.CancellationToken ?? System.Threading.CancellationToken.None)" - : $"typedInstance.{methodName}(({tupleType.GloballyQualified()})args[0])"; - if (isAsync) - { - writer.AppendLine($"await {methodCallDirect};"); - } - else - { - writer.AppendLine($"{methodCallDirect};"); - } - writer.Unindent(); - writer.AppendLine("}"); - writer.AppendLine("else"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendLine($"throw new global::System.ArgumentException($\"Expected {tupleType.TupleElements.Length} unwrapped elements or 1 wrapped tuple, but got {{args.Length}} arguments\");"); - writer.Unindent(); - writer.AppendLine("}"); - } - else if (parametersFromArgs.Length == 0) - { - var methodCall = hasCancellationToken - ? $"typedInstance.{methodName}(context?.CancellationToken ?? System.Threading.CancellationToken.None)" - : $"typedInstance.{methodName}()"; - if (isAsync) - { - writer.AppendLine($"await {methodCall};"); - } - else - { - writer.AppendLine($"{methodCall};"); - writer.AppendLine("await global::System.Threading.Tasks.Task.CompletedTask;"); - } - } - else - { - // Count required parameters (those without default values, excluding CancellationToken and params parameters) - var requiredParamCount = parametersFromArgs.Count(p => !p.HasExplicitDefaultValue && p is { IsOptional: false, IsParams: false }); - - // Generate runtime logic to handle variable argument counts - writer.AppendLine("switch (args.Length)"); - writer.AppendLine("{"); - writer.Indent(); - - // Check if last parameter is params array - var hasParams = parametersFromArgs.Length > 0 && parametersFromArgs[parametersFromArgs.Length - 1].IsParams; - - // For params arrays, we need to handle any number of arguments >= required count - // Generate a reasonable number of cases plus a default that handles the rest - var casesToGenerate = hasParams ? 10 : parametersFromArgs.Length - requiredParamCount + 1; - - // Generate cases for each valid argument count - for (var i = 0; i < casesToGenerate && requiredParamCount + i <= parametersFromArgs.Length + 5; i++) - { - var argCount = requiredParamCount + i; - writer.AppendLine($"case {argCount}:"); - writer.Indent(); - - // Build the arguments to pass, handling params arrays correctly - var argsToPass = TupleArgumentHelper.GenerateArgumentAccessWithParams(parametersFromArgs, "args", argCount); - - // Add CancellationToken if present - if (hasCancellationToken) - { - argsToPass.Add("context?.CancellationToken ?? System.Threading.CancellationToken.None"); - } - - var methodCall = $"typedInstance.{methodName}({string.Join(", ", argsToPass)})"; - - if (isAsync) - { - writer.AppendLine($"await {methodCall};"); - } - else - { - writer.AppendLine($"{methodCall};"); - } - writer.AppendLine("break;"); - writer.Unindent(); - } - - writer.AppendLine("default:"); - writer.Indent(); - if (requiredParamCount == parametersFromArgs.Length && !hasParams) - { - writer.AppendLine($"throw new global::System.ArgumentException($\"Expected exactly {parametersFromArgs.Length} argument{(parametersFromArgs.Length == 1 ? "" : "s")}, but got {{args.Length}}\");"); - } - else - { - writer.AppendLine($"throw new global::System.ArgumentException($\"Expected between {requiredParamCount} and {parametersFromArgs.Length} arguments, but got {{args.Length}}\");"); - } - writer.Unindent(); - - writer.Unindent(); - writer.AppendLine("}"); - - if (!isAsync) - { - writer.AppendLine("await global::System.Threading.Tasks.Task.CompletedTask;"); - } - } - - writer.Unindent(); - writer.AppendLine("},"); - - // Also generate InvokeTypedTest which is required by CreateExecutableTestFactory + // Generate InvokeTypedTest which is required by CreateExecutableTestFactory writer.AppendLine("InvokeTypedTest = async (instance, args, cancellationToken) =>"); writer.AppendLine("{"); writer.Indent(); @@ -2843,17 +2610,6 @@ private static void GenerateGenericTestWithConcreteTypes( writer.Unindent(); writer.AppendLine("},"); - // Generate TestInvoker for generic methods - var isAsync = IsAsyncMethod(testMethod.MethodSymbol); - var hasCancellationToken = testMethod.MethodSymbol.Parameters.Any(p => - p.Type.Name == "CancellationToken" && - p.Type.ContainingNamespace?.ToString() == "System.Threading"); - var parametersFromArgs = testMethod.MethodSymbol.Parameters - .Where(p => p.Type.Name != "CancellationToken") - .ToArray(); - - GenerateGenericTestInvoker(writer, testMethod, methodName, isAsync, hasCancellationToken, parametersFromArgs); - // Generate concrete instantiations dictionary writer.AppendLine("ConcreteInstantiations = new global::System.Collections.Generic.Dictionary"); writer.AppendLine("{"); From bc3c10e44bd0eabc9743ebffea684b58abe3929f Mon Sep 17 00:00:00 2001 From: Tom Longhurst <30480171+thomhurst@users.noreply.github.com> Date: Sun, 5 Oct 2025 20:17:03 +0100 Subject: [PATCH 2/2] fix: improve null handling in test argument casting --- .../Tests2112.Test.verified.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TUnit.Core.SourceGenerator.Tests/Tests2112.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests2112.Test.verified.txt index b882d6c9b2..99dc0832d7 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests2112.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests2112.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -84,7 +84,7 @@ internal sealed class Tests_Test_TestSource_GUID : global::TUnit.Core.Interfaces instance.Test(TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[0]); break; case 2: - instance.Test(TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[] { TUnit.Core.Helpers.CastHelper.Cast(args[1]) }); + instance.Test(TUnit.Core.Helpers.CastHelper.Cast(args[0]), (args[1] is null ? null : args[1] is long[] arr ? arr : new long[] { TUnit.Core.Helpers.CastHelper.Cast(args[1]) })); break; case 3: instance.Test(TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[] { TUnit.Core.Helpers.CastHelper.Cast(args[1]), TUnit.Core.Helpers.CastHelper.Cast(args[2]) }); @@ -210,7 +210,7 @@ internal sealed class Tests_Test2_TestSource_GUID : global::TUnit.Core.Interface instance.Test2(TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[0]); break; case 2: - instance.Test2(TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[] { TUnit.Core.Helpers.CastHelper.Cast(args[1]) }); + instance.Test2(TUnit.Core.Helpers.CastHelper.Cast(args[0]), (args[1] is null ? null : args[1] is long[] arr ? arr : new long[] { TUnit.Core.Helpers.CastHelper.Cast(args[1]) })); break; case 3: instance.Test2(TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[] { TUnit.Core.Helpers.CastHelper.Cast(args[1]), TUnit.Core.Helpers.CastHelper.Cast(args[2]) });