From 396191d21784565eed59ebfc764fd0d5c2cfc3d4 Mon Sep 17 00:00:00 2001 From: Tom Longhurst <30480171+thomhurst@users.noreply.github.com> Date: Sun, 1 Mar 2026 21:35:07 +0000 Subject: [PATCH 1/2] perf: eliminate <>c display class from generated TestSource classes Replace all lambdas in generated non-generic TestSource classes with named static methods, preventing the C# compiler from generating a <>c display class. This eliminates ~30,000 JIT compilations for 10,000 test sources. Changes: - Add parameter-based AssemblyMetadata.GetOrAdd(string, string) overload - Add parameter-based ClassMetadata.GetOrAdd(string, ClassMetadata) overload - Update MetadataGenerationHelper to emit parameter-based GetOrAdd calls - Convert AttributeFactory, InstanceFactory, InvokeTypedTest from lambdas to named static methods (__CreateAttributes, __CreateInstance, __InvokeTest) - Refactor InstanceFactoryGenerator with extracted body methods --- .../AbstractTests.Concrete1.verified.txt | 65 +- .../AbstractTests.Concrete2.verified.txt | 201 +-- .../AfterAllTests.Test.verified.txt | 126 +- .../AfterTests.Test.verified.txt | 126 +- .../ArgsAsArrayTests.Test.verified.txt | 423 ++++--- ...thImplicitConverterTests.Test.verified.txt | 166 +-- .../AssemblyAfterTests.Test.verified.txt | 310 ++--- .../AssemblyBeforeTests.Test.verified.txt | 310 ++--- ...lyLoaderTests.Test.DotNet10_0.verified.txt | 191 +-- ...blyLoaderTests.Test.DotNet8_0.verified.txt | 191 +-- ...blyLoaderTests.Test.DotNet9_0.verified.txt | 191 +-- ...hodDataSourceDrivenTests.Test.verified.txt | 567 +++++---- .../AttributeTests.Test.verified.txt | 89 +- .../BasicTests.Test.DotNet10_0.verified.txt | 191 +-- .../BasicTests.Test.DotNet8_0.verified.txt | 191 +-- .../BasicTests.Test.DotNet9_0.verified.txt | 191 +-- .../BeforeAllTests.Test.verified.txt | 126 +- .../BeforeTests.Test.verified.txt | 126 +- ...lableTypeTest.Test.DotNet10_0.verified.txt | 67 +- ...llableTypeTest.Test.DotNet8_0.verified.txt | 67 +- ...llableTypeTest.Test.DotNet9_0.verified.txt | 67 +- ...sAndMethodArgumentsTests.Test.verified.txt | 284 ++--- .../ClassConstructorTest.Test.verified.txt | 115 +- ...assDataSourceDrivenTests.Test.verified.txt | 571 +++++---- ...ssDataSourceDrivenTests2.Test.verified.txt | 176 +-- ...ceDrivenTestsSharedKeyed.Test.verified.txt | 166 +-- ...pleDataSourceDrivenTests.Test.verified.txt | 233 ++-- .../ConcreteClassTests.Test.verified.txt | 201 +-- ...nflictingNamespace.DotNet10_0.verified.txt | 191 +-- ...onflictingNamespace.DotNet8_0.verified.txt | 191 +-- ...onflictingNamespace.DotNet9_0.verified.txt | 191 +-- ...nflictingNamespace.DotNet10_0.verified.txt | 830 +++++++------ ...onflictingNamespace.DotNet8_0.verified.txt | 830 +++++++------ ...onflictingNamespace.DotNet9_0.verified.txt | 830 +++++++------ ...nflictingNamespace.DotNet10_0.verified.txt | 308 ++--- ...onflictingNamespace.DotNet8_0.verified.txt | 308 ++--- ...onflictingNamespace.DotNet9_0.verified.txt | 308 ++--- ...nflictingNamespace.DotNet10_0.verified.txt | 1059 ++++++++-------- ...onflictingNamespace.DotNet8_0.verified.txt | 1059 ++++++++-------- ...onflictingNamespace.DotNet9_0.verified.txt | 1059 ++++++++-------- ...nflictingNamespace.DotNet10_0.verified.txt | 579 +++++---- ...onflictingNamespace.DotNet8_0.verified.txt | 579 +++++---- ...onflictingNamespace.DotNet9_0.verified.txt | 579 +++++---- ...nflictingNamespace.DotNet10_0.verified.txt | 83 +- ...onflictingNamespace.DotNet8_0.verified.txt | 83 +- ...onflictingNamespace.DotNet9_0.verified.txt | 83 +- .../ConstantArgumentsTests.Test.verified.txt | 567 +++++---- ...ConstantInBaseClassTests.Test.verified.txt | 81 +- ...InterpolatedStringsTests.Test.verified.txt | 81 +- .../CustomDisplayNameTests.Test.verified.txt | 908 +++++++------- .../DataDrivenTests.Test.verified.txt | 830 +++++++------ ...ithDataSourceMethodTests.Test.verified.txt | 106 +- ...ataSourceGeneratorTests.Typed.verified.txt | 390 +++--- ...aSourceGeneratorTests.Untyped.verified.txt | 79 +- .../DecimalArgumentTests.Test.verified.txt | 976 ++++++++------- ...nScannerTests.Test.DotNet10_0.verified.txt | 191 +-- ...onScannerTests.Test.DotNet8_0.verified.txt | 191 +-- ...onScannerTests.Test.DotNet9_0.verified.txt | 191 +-- .../EnumMemberNamesTests.Test.verified.txt | 83 +- ...bleDataSourceDrivenTests.Test.verified.txt | 245 ++-- ...pleDataSourceDrivenTests.Test.verified.txt | 83 +- ...xpectedArgumentTypeTests.Test.verified.txt | 162 +-- .../GenericMethodTests.Test.verified.txt | 68 +- ...aSource_Should_Generate_Tests.verified.txt | 1046 +++++++--------- ...cRegistry_WhenNoGenericsFound.verified.txt | 65 +- ...Constraints_WithInstantiation.verified.txt | 68 +- ...ass_WithExplicitInstantiation.verified.txt | 68 +- ...hod_WithExplicitInstantiation.verified.txt | 68 +- ...est_MultipleGenericParameters.verified.txt | 68 +- ...Tests.Test_NestedGenericTypes.verified.txt | 68 +- ...obalStaticAfterEachTests.Test.verified.txt | 310 ++--- ...balStaticBeforeEachTests.Test.verified.txt | 310 ++--- .../Hooks1589.Test.verified.txt | 86 +- .../Hooks1594.Test.verified.txt | 88 +- ...oksTests.DisposableFieldTests.verified.txt | 46 +- ...ritedPropertySetterTests.Test.verified.txt | 351 +++--- ...romDifferentProjectTests.Test.verified.txt | 462 +++---- ...heritsTestsAbstractTests.Test.verified.txt | 201 +-- .../InheritsTestsTests.Test.verified.txt | 389 +++--- .../Issue2887Tests.Test.verified.txt | 86 +- .../MatrixTests.Test.verified.txt | 1059 ++++++++-------- ...hodDataSourceDrivenTests.Test.verified.txt | 579 +++++---- ...thCancellationTokenTests.Test.verified.txt | 87 +- ...assDataSourceDrivenTests.Test.verified.txt | 284 ++--- .../NameOfArgumentTests.Test.verified.txt | 81 +- ...ullableByteArgumentTests.Test.verified.txt | 166 +-- .../NumberArgumentTests.Test.verified.txt | 498 ++++---- .../NumberArgumentTests.TestDE.verified.txt | 498 ++++---- .../PriorityFilteringTests.Test.verified.txt | 390 +++--- .../PropertySetterTests.Test.verified.txt | 264 ++-- ...atTests.Assembly_Level_Repeat.verified.txt | 136 +- .../RepeatTests.Test.verified.txt | 211 ++-- ...TAThreadTests.Test.DotNet10_0.verified.txt | 1093 +++++++++-------- ...STAThreadTests.Test.DotNet8_0.verified.txt | 1093 +++++++++-------- ...STAThreadTests.Test.DotNet9_0.verified.txt | 1093 +++++++++-------- .../StringArgumentTests.Test.verified.txt | 166 +-- .../Tests.Test.verified.txt | 245 ++-- .../Tests1538.Test.verified.txt | 166 +-- .../Tests1539.Test.verified.txt | 75 +- .../Tests1589.Test.verified.txt | 86 +- .../Tests1594.Test.verified.txt | 88 +- .../Tests1603.Test.verified.txt | 162 +-- .../Tests1692.Test.verified.txt | 81 +- .../Tests1821.Test.verified.txt | 200 +-- .../Tests1889.Test.DotNet10_0.verified.txt | 239 ++-- .../Tests1889.Test.DotNet8_0.verified.txt | 239 ++-- .../Tests1889.Test.DotNet9_0.verified.txt | 239 ++-- .../Tests1899.Test.verified.txt | 69 +- .../Tests2083.Test.verified.txt | 83 +- .../Tests2085.Test.verified.txt | 162 +-- .../Tests2112.Test.verified.txt | 286 ++--- .../Tests2136.Test.verified.txt | 134 +- ...utCancellationTokenTests.Test.verified.txt | 760 ++++++------ ...pleDataSourceDrivenTests.Test.verified.txt | 83 +- ...st_AotSafeDataSourceFactories.verified.txt | 81 +- ...sts.Test_ConfigurationSupport.verified.txt | 65 +- ..._ModuleInitializer_Generation.verified.txt | 65 +- ...nglyTypedDelegates_Generation.verified.txt | 65 +- .../Helpers/InstanceFactoryGenerator.cs | 75 +- .../Generators/TestMetadataGenerator.cs | 141 ++- .../Utilities/MetadataGenerationHelper.cs | 62 +- .../Models/TestModels/AssemblyMetadata.cs | 5 + TUnit.Core/Models/TestModels/ClassMetadata.cs | 22 + ...Has_No_API_Changes.DotNet10_0.verified.txt | 2 + ..._Has_No_API_Changes.DotNet8_0.verified.txt | 2 + ..._Has_No_API_Changes.DotNet9_0.verified.txt | 2 + 126 files changed, 18406 insertions(+), 17166 deletions(-) diff --git a/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete1.verified.txt b/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete1.verified.txt index d25c50fd21..225a9213f2 100644 --- a/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete1.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete1.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClass TestClassType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1), TestMethodName = "AssertClassName", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.InheritsTestsAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -36,34 +32,20 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClass ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AbstractTests.ConcreteClass1", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AbstractTests.ConcreteClass1", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1)), - Name = "ConcreteClass1", - Namespace = "TUnit.TestProject.AbstractTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1)), + Name = "ConcreteClass1", + Namespace = "TUnit.TestProject.AbstractTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.AbstractTests.ConcreteClass1(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.AssertClassName()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -86,6 +68,29 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClass Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.InheritsTestsAttribute() + ]; + } + private static global::TUnit.TestProject.AbstractTests.ConcreteClass1 __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.AbstractTests.ConcreteClass1(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AbstractTests.ConcreteClass1 instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.AssertClassName()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClassName_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete2.verified.txt b/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete2.verified.txt index 8aac896da7..925070d2e5 100644 --- a/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete2.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete2.verified.txt @@ -15,12 +15,7 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_ TestClassType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), TestMethodName = "SecondTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.InheritsTestsAttribute(), - new global::TUnit.Core.InheritsTestsAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -37,35 +32,20 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_ ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AbstractTests.ConcreteClass2", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AbstractTests.ConcreteClass2", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2)), - Name = "ConcreteClass2", - Namespace = "TUnit.TestProject.AbstractTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2)), + Name = "ConcreteClass2", + Namespace = "TUnit.TestProject.AbstractTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.AbstractTests.ConcreteClass2(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.SecondTest(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -88,6 +68,31 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_ Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.InheritsTestsAttribute(), + new global::TUnit.Core.InheritsTestsAttribute() + ]; + } + private static global::TUnit.TestProject.AbstractTests.ConcreteClass2 __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.AbstractTests.ConcreteClass2(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AbstractTests.ConcreteClass2 instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.SecondTest(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_ModuleInitializer { @@ -118,12 +123,7 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_AssertClass TestClassType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), TestMethodName = "AssertClassName", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.InheritsTestsAttribute(), - new global::TUnit.Core.InheritsTestsAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -140,34 +140,20 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_AssertClass ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AbstractTests.ConcreteClass2", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AbstractTests.ConcreteClass2", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2)), - Name = "ConcreteClass2", - Namespace = "TUnit.TestProject.AbstractTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2)), + Name = "ConcreteClass2", + Namespace = "TUnit.TestProject.AbstractTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.AbstractTests.ConcreteClass2(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.AssertClassName()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -190,6 +176,30 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_AssertClass Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.InheritsTestsAttribute(), + new global::TUnit.Core.InheritsTestsAttribute() + ]; + } + private static global::TUnit.TestProject.AbstractTests.ConcreteClass2 __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.AbstractTests.ConcreteClass2(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AbstractTests.ConcreteClass2 instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.AssertClassName()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_AbstractTests_ConcreteClass2_AssertClassName_ModuleInitializer { @@ -220,11 +230,7 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClass TestClassType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1), TestMethodName = "AssertClassName", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.InheritsTestsAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -241,34 +247,20 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClass ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AbstractTests.ConcreteClass1", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AbstractTests.ConcreteClass1", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1)), - Name = "ConcreteClass1", - Namespace = "TUnit.TestProject.AbstractTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1)), + Name = "ConcreteClass1", + Namespace = "TUnit.TestProject.AbstractTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.AbstractTests.ConcreteClass1(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.AssertClassName()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -291,6 +283,29 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClass Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.InheritsTestsAttribute() + ]; + } + private static global::TUnit.TestProject.AbstractTests.ConcreteClass1 __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.AbstractTests.ConcreteClass1(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AbstractTests.ConcreteClass1 instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.AssertClassName()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClassName_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/AfterAllTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/AfterAllTests.Test.verified.txt index a3ad44119d..bdc74075c7 100644 --- a/TUnit.Core.SourceGenerator.Tests/AfterAllTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AfterAllTests.Test.verified.txt @@ -15,10 +15,7 @@ internal sealed class TUnit_TestProject_AfterTests_CleanupTests_Test1_TestSource TestClassType = typeof(global::TUnit.TestProject.AfterTests.CleanupTests), TestMethodName = "Test1", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -35,34 +32,20 @@ internal sealed class TUnit_TestProject_AfterTests_CleanupTests_Test1_TestSource ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.CleanupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.CleanupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AfterTests.CleanupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.CleanupTests)), - Name = "CleanupTests", - Namespace = "TUnit.TestProject.AfterTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AfterTests.CleanupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.CleanupTests)), + Name = "CleanupTests", + Namespace = "TUnit.TestProject.AfterTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.AfterTests.CleanupTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.Test1()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -85,6 +68,28 @@ internal sealed class TUnit_TestProject_AfterTests_CleanupTests_Test1_TestSource Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.AfterTests.CleanupTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.AfterTests.CleanupTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AfterTests.CleanupTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.Test1()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_AfterTests_CleanupTests_Test1_ModuleInitializer { @@ -115,10 +120,7 @@ internal sealed class TUnit_TestProject_AfterTests_CleanupTests_Test2_TestSource TestClassType = typeof(global::TUnit.TestProject.AfterTests.CleanupTests), TestMethodName = "Test2", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -135,34 +137,20 @@ internal sealed class TUnit_TestProject_AfterTests_CleanupTests_Test2_TestSource ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.CleanupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.CleanupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AfterTests.CleanupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.CleanupTests)), - Name = "CleanupTests", - Namespace = "TUnit.TestProject.AfterTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AfterTests.CleanupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.CleanupTests)), + Name = "CleanupTests", + Namespace = "TUnit.TestProject.AfterTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.AfterTests.CleanupTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.Test2()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -185,6 +173,28 @@ internal sealed class TUnit_TestProject_AfterTests_CleanupTests_Test2_TestSource Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.AfterTests.CleanupTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.AfterTests.CleanupTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AfterTests.CleanupTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.Test2()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_AfterTests_CleanupTests_Test2_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/AfterTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/AfterTests.Test.verified.txt index a3ad44119d..bdc74075c7 100644 --- a/TUnit.Core.SourceGenerator.Tests/AfterTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AfterTests.Test.verified.txt @@ -15,10 +15,7 @@ internal sealed class TUnit_TestProject_AfterTests_CleanupTests_Test1_TestSource TestClassType = typeof(global::TUnit.TestProject.AfterTests.CleanupTests), TestMethodName = "Test1", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -35,34 +32,20 @@ internal sealed class TUnit_TestProject_AfterTests_CleanupTests_Test1_TestSource ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.CleanupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.CleanupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AfterTests.CleanupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.CleanupTests)), - Name = "CleanupTests", - Namespace = "TUnit.TestProject.AfterTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AfterTests.CleanupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.CleanupTests)), + Name = "CleanupTests", + Namespace = "TUnit.TestProject.AfterTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.AfterTests.CleanupTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.Test1()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -85,6 +68,28 @@ internal sealed class TUnit_TestProject_AfterTests_CleanupTests_Test1_TestSource Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.AfterTests.CleanupTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.AfterTests.CleanupTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AfterTests.CleanupTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.Test1()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_AfterTests_CleanupTests_Test1_ModuleInitializer { @@ -115,10 +120,7 @@ internal sealed class TUnit_TestProject_AfterTests_CleanupTests_Test2_TestSource TestClassType = typeof(global::TUnit.TestProject.AfterTests.CleanupTests), TestMethodName = "Test2", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -135,34 +137,20 @@ internal sealed class TUnit_TestProject_AfterTests_CleanupTests_Test2_TestSource ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.CleanupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.CleanupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AfterTests.CleanupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.CleanupTests)), - Name = "CleanupTests", - Namespace = "TUnit.TestProject.AfterTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AfterTests.CleanupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.CleanupTests)), + Name = "CleanupTests", + Namespace = "TUnit.TestProject.AfterTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.AfterTests.CleanupTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.Test2()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -185,6 +173,28 @@ internal sealed class TUnit_TestProject_AfterTests_CleanupTests_Test2_TestSource Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.AfterTests.CleanupTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.AfterTests.CleanupTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AfterTests.CleanupTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.Test2()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_AfterTests_CleanupTests_Test2_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/ArgsAsArrayTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ArgsAsArrayTests.Test.verified.txt index e8a0fbcbfc..ad73fa4b66 100644 --- a/TUnit.Core.SourceGenerator.Tests/ArgsAsArrayTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ArgsAsArrayTests.Test.verified.txt @@ -15,10 +15,7 @@ internal sealed class TUnit_TestProject_ArgsAsArrayTests_Params__string___TestSo TestClassType = typeof(global::TUnit.TestProject.ArgsAsArrayTests), TestMethodName = "Params", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("arg1", "arg2", "arg3"), @@ -47,73 +44,20 @@ internal sealed class TUnit_TestProject_ArgsAsArrayTests_Params__string___TestSo ReflectionInfo = typeof(global::TUnit.TestProject.ArgsAsArrayTests).GetMethod("Params", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string[]) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ArgsAsArrayTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ArgsAsArrayTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.ArgsAsArrayTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ArgsAsArrayTests)), - Name = "ArgsAsArrayTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.ArgsAsArrayTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ArgsAsArrayTests)), + Name = "ArgsAsArrayTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.ArgsAsArrayTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 0: - { - instance.Params(new string[0]); - return default(global::System.Threading.Tasks.ValueTask); - } - case 1: - { - instance.Params((args[0] is null ? null : args[0] is string[] arr ? arr : new string[] { global::TUnit.Core.Helpers.CastHelper.Cast(args[0]) })); - return default(global::System.Threading.Tasks.ValueTask); - } - case 2: - { - instance.Params(new string[] { global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]) }); - return default(global::System.Threading.Tasks.ValueTask); - } - case 3: - { - instance.Params(new string[] { global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]) }); - return default(global::System.Threading.Tasks.ValueTask); - } - case 4: - { - instance.Params(new string[] { global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]) }); - return default(global::System.Threading.Tasks.ValueTask); - } - case 5: - { - instance.Params(new string[] { global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]), global::TUnit.Core.Helpers.CastHelper.Cast(args[4]) }); - return default(global::System.Threading.Tasks.ValueTask); - } - case 6: - { - instance.Params(new string[] { global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]), global::TUnit.Core.Helpers.CastHelper.Cast(args[4]), global::TUnit.Core.Helpers.CastHelper.Cast(args[5]) }); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected between 0 and 1 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -136,6 +80,67 @@ internal sealed class TUnit_TestProject_ArgsAsArrayTests_Params__string___TestSo Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.ArgsAsArrayTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.ArgsAsArrayTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ArgsAsArrayTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 0: + { + instance.Params(new string[0]); + return default(global::System.Threading.Tasks.ValueTask); + } + case 1: + { + instance.Params((args[0] is null ? null : args[0] is string[] arr ? arr : new string[] { global::TUnit.Core.Helpers.CastHelper.Cast(args[0]) })); + return default(global::System.Threading.Tasks.ValueTask); + } + case 2: + { + instance.Params(new string[] { global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]) }); + return default(global::System.Threading.Tasks.ValueTask); + } + case 3: + { + instance.Params(new string[] { global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]) }); + return default(global::System.Threading.Tasks.ValueTask); + } + case 4: + { + instance.Params(new string[] { global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]) }); + return default(global::System.Threading.Tasks.ValueTask); + } + case 5: + { + instance.Params(new string[] { global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]), global::TUnit.Core.Helpers.CastHelper.Cast(args[4]) }); + return default(global::System.Threading.Tasks.ValueTask); + } + case 6: + { + instance.Params(new string[] { global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]), global::TUnit.Core.Helpers.CastHelper.Cast(args[4]), global::TUnit.Core.Helpers.CastHelper.Cast(args[5]) }); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected between 0 and 1 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_ArgsAsArrayTests_Params__string___ModuleInitializer { @@ -166,10 +171,7 @@ internal sealed class TUnit_TestProject_ArgsAsArrayTests_ParamsEnumerable__IEnum TestClassType = typeof(global::TUnit.TestProject.ArgsAsArrayTests), TestMethodName = "ParamsEnumerable", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("arg1", "arg2", "arg3"), @@ -198,73 +200,20 @@ internal sealed class TUnit_TestProject_ArgsAsArrayTests_ParamsEnumerable__IEnum ReflectionInfo = typeof(global::TUnit.TestProject.ArgsAsArrayTests).GetMethod("ParamsEnumerable", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Collections.Generic.IEnumerable) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ArgsAsArrayTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ArgsAsArrayTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.ArgsAsArrayTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ArgsAsArrayTests)), - Name = "ArgsAsArrayTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.ArgsAsArrayTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ArgsAsArrayTests)), + Name = "ArgsAsArrayTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.ArgsAsArrayTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 0: - { - instance.ParamsEnumerable(global::TUnit.Core.Helpers.CastHelper.Cast>(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - case 1: - { - instance.ParamsEnumerable(global::TUnit.Core.Helpers.CastHelper.Cast>(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - case 2: - { - instance.ParamsEnumerable(global::TUnit.Core.Helpers.CastHelper.Cast>(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - case 3: - { - instance.ParamsEnumerable(global::TUnit.Core.Helpers.CastHelper.Cast>(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - case 4: - { - instance.ParamsEnumerable(global::TUnit.Core.Helpers.CastHelper.Cast>(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - case 5: - { - instance.ParamsEnumerable(global::TUnit.Core.Helpers.CastHelper.Cast>(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - case 6: - { - instance.ParamsEnumerable(global::TUnit.Core.Helpers.CastHelper.Cast>(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected between 0 and 1 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -287,6 +236,67 @@ internal sealed class TUnit_TestProject_ArgsAsArrayTests_ParamsEnumerable__IEnum Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.ArgsAsArrayTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.ArgsAsArrayTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ArgsAsArrayTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 0: + { + instance.ParamsEnumerable(global::TUnit.Core.Helpers.CastHelper.Cast>(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + case 1: + { + instance.ParamsEnumerable(global::TUnit.Core.Helpers.CastHelper.Cast>(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + case 2: + { + instance.ParamsEnumerable(global::TUnit.Core.Helpers.CastHelper.Cast>(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + case 3: + { + instance.ParamsEnumerable(global::TUnit.Core.Helpers.CastHelper.Cast>(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + case 4: + { + instance.ParamsEnumerable(global::TUnit.Core.Helpers.CastHelper.Cast>(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + case 5: + { + instance.ParamsEnumerable(global::TUnit.Core.Helpers.CastHelper.Cast>(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + case 6: + { + instance.ParamsEnumerable(global::TUnit.Core.Helpers.CastHelper.Cast>(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected between 0 and 1 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_ArgsAsArrayTests_ParamsEnumerable__IEnumerable_string__ModuleInitializer { @@ -317,10 +327,7 @@ internal sealed class TUnit_TestProject_ArgsAsArrayTests_Following_Non_Params__i TestClassType = typeof(global::TUnit.TestProject.ArgsAsArrayTests), TestMethodName = "Following_Non_Params", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1, "arg1", "arg2", "arg3"), @@ -356,73 +363,20 @@ internal sealed class TUnit_TestProject_ArgsAsArrayTests_Following_Non_Params__i ReflectionInfo = typeof(global::TUnit.TestProject.ArgsAsArrayTests).GetMethod("Following_Non_Params", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(global::System.Collections.Generic.IEnumerable) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ArgsAsArrayTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ArgsAsArrayTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.ArgsAsArrayTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ArgsAsArrayTests)), - Name = "ArgsAsArrayTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.ArgsAsArrayTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ArgsAsArrayTests)), + Name = "ArgsAsArrayTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.ArgsAsArrayTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.Following_Non_Params(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast>(args[1])); - return default(global::System.Threading.Tasks.ValueTask); - } - case 2: - { - instance.Following_Non_Params(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast>(args[1])); - return default(global::System.Threading.Tasks.ValueTask); - } - case 3: - { - instance.Following_Non_Params(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast>(args[1])); - return default(global::System.Threading.Tasks.ValueTask); - } - case 4: - { - instance.Following_Non_Params(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast>(args[1])); - return default(global::System.Threading.Tasks.ValueTask); - } - case 5: - { - instance.Following_Non_Params(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast>(args[1])); - return default(global::System.Threading.Tasks.ValueTask); - } - case 6: - { - instance.Following_Non_Params(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast>(args[1])); - return default(global::System.Threading.Tasks.ValueTask); - } - case 7: - { - instance.Following_Non_Params(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast>(args[1])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected between 1 and 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -445,6 +399,67 @@ internal sealed class TUnit_TestProject_ArgsAsArrayTests_Following_Non_Params__i Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.ArgsAsArrayTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.ArgsAsArrayTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ArgsAsArrayTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.Following_Non_Params(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast>(args[1])); + return default(global::System.Threading.Tasks.ValueTask); + } + case 2: + { + instance.Following_Non_Params(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast>(args[1])); + return default(global::System.Threading.Tasks.ValueTask); + } + case 3: + { + instance.Following_Non_Params(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast>(args[1])); + return default(global::System.Threading.Tasks.ValueTask); + } + case 4: + { + instance.Following_Non_Params(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast>(args[1])); + return default(global::System.Threading.Tasks.ValueTask); + } + case 5: + { + instance.Following_Non_Params(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast>(args[1])); + return default(global::System.Threading.Tasks.ValueTask); + } + case 6: + { + instance.Following_Non_Params(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast>(args[1])); + return default(global::System.Threading.Tasks.ValueTask); + } + case 7: + { + instance.Following_Non_Params(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast>(args[1])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected between 1 and 2 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_ArgsAsArrayTests_Following_Non_Params__int_IEnumerable_string__ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/ArgumentWithImplicitConverterTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ArgumentWithImplicitConverterTests.Test.verified.txt index 1cf5c30af4..75ce270b40 100644 --- a/TUnit.Core.SourceGenerator.Tests/ArgumentWithImplicitConverterTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ArgumentWithImplicitConverterTests.Test.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_ArgumentWithImplicitConverterTests_Expli TestClassType = typeof(global::TUnit.TestProject.ArgumentWithImplicitConverterTests), TestMethodName = "Explicit", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1), @@ -50,43 +46,20 @@ internal sealed class TUnit_TestProject_ArgumentWithImplicitConverterTests_Expli ReflectionInfo = typeof(global::TUnit.TestProject.ArgumentWithImplicitConverterTests).GetMethod("Explicit", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.ExplicitInteger) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ArgumentWithImplicitConverterTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ArgumentWithImplicitConverterTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.ArgumentWithImplicitConverterTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ArgumentWithImplicitConverterTests)), - Name = "ArgumentWithImplicitConverterTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.ArgumentWithImplicitConverterTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ArgumentWithImplicitConverterTests)), + Name = "ArgumentWithImplicitConverterTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.ArgumentWithImplicitConverterTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.Explicit(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -109,6 +82,38 @@ internal sealed class TUnit_TestProject_ArgumentWithImplicitConverterTests_Expli Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.ArgumentWithImplicitConverterTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.ArgumentWithImplicitConverterTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ArgumentWithImplicitConverterTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.Explicit(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_ArgumentWithImplicitConverterTests_Explicit__ExplicitInteger_ModuleInitializer { @@ -139,11 +144,7 @@ internal sealed class TUnit_TestProject_ArgumentWithImplicitConverterTests_Impli TestClassType = typeof(global::TUnit.TestProject.ArgumentWithImplicitConverterTests), TestMethodName = "Implicit", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1), @@ -174,43 +175,20 @@ internal sealed class TUnit_TestProject_ArgumentWithImplicitConverterTests_Impli ReflectionInfo = typeof(global::TUnit.TestProject.ArgumentWithImplicitConverterTests).GetMethod("Implicit", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.ImplicitInteger) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ArgumentWithImplicitConverterTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ArgumentWithImplicitConverterTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.ArgumentWithImplicitConverterTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ArgumentWithImplicitConverterTests)), - Name = "ArgumentWithImplicitConverterTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.ArgumentWithImplicitConverterTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ArgumentWithImplicitConverterTests)), + Name = "ArgumentWithImplicitConverterTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.ArgumentWithImplicitConverterTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.Implicit(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -233,6 +211,38 @@ internal sealed class TUnit_TestProject_ArgumentWithImplicitConverterTests_Impli Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.ArgumentWithImplicitConverterTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.ArgumentWithImplicitConverterTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ArgumentWithImplicitConverterTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.Implicit(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_ArgumentWithImplicitConverterTests_Implicit__ImplicitInteger_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/AssemblyAfterTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/AssemblyAfterTests.Test.verified.txt index 0568ca24fe..d478b1163e 100644 --- a/TUnit.Core.SourceGenerator.Tests/AssemblyAfterTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AssemblyAfterTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -35,20 +35,16 @@ internal static class TUnit_TestProject_AfterTests_AssemblyBase1_AfterAll1_After ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.AssemblyBase1", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.AssemblyBase1", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AfterTests.AssemblyBase1), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.AssemblyBase1)), - Name = "AssemblyBase1", - Namespace = "TUnit.TestProject.AfterTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AfterTests.AssemblyBase1), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.AssemblyBase1)), + Name = "AssemblyBase1", + Namespace = "TUnit.TestProject.AfterTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -106,20 +102,16 @@ internal static class TUnit_TestProject_AfterTests_AssemblyBase1_AfterEach1_Afte ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.AssemblyBase1", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.AssemblyBase1", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AfterTests.AssemblyBase1), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.AssemblyBase1)), - Name = "AssemblyBase1", - Namespace = "TUnit.TestProject.AfterTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AfterTests.AssemblyBase1), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.AssemblyBase1)), + Name = "AssemblyBase1", + Namespace = "TUnit.TestProject.AfterTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -176,20 +168,16 @@ internal static class TUnit_TestProject_AfterTests_AssemblyBase2_AfterAll2_After ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.AssemblyBase2", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.AssemblyBase2", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AfterTests.AssemblyBase2), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.AssemblyBase2)), - Name = "AssemblyBase2", - Namespace = "TUnit.TestProject.AfterTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AfterTests.AssemblyBase2), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.AssemblyBase2)), + Name = "AssemblyBase2", + Namespace = "TUnit.TestProject.AfterTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -247,20 +235,16 @@ internal static class TUnit_TestProject_AfterTests_AssemblyBase2_AfterEach2_Afte ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.AssemblyBase2", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.AssemblyBase2", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AfterTests.AssemblyBase2), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.AssemblyBase2)), - Name = "AssemblyBase2", - Namespace = "TUnit.TestProject.AfterTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AfterTests.AssemblyBase2), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.AssemblyBase2)), + Name = "AssemblyBase2", + Namespace = "TUnit.TestProject.AfterTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -317,20 +301,16 @@ internal static class TUnit_TestProject_AfterTests_AssemblyBase3_AfterAll3_After ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.AssemblyBase3", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.AssemblyBase3", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AfterTests.AssemblyBase3), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.AssemblyBase3)), - Name = "AssemblyBase3", - Namespace = "TUnit.TestProject.AfterTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AfterTests.AssemblyBase3), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.AssemblyBase3)), + Name = "AssemblyBase3", + Namespace = "TUnit.TestProject.AfterTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -388,20 +368,16 @@ internal static class TUnit_TestProject_AfterTests_AssemblyBase3_AfterEach3_Afte ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.AssemblyBase3", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.AssemblyBase3", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AfterTests.AssemblyBase3), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.AssemblyBase3)), - Name = "AssemblyBase3", - Namespace = "TUnit.TestProject.AfterTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AfterTests.AssemblyBase3), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.AssemblyBase3)), + Name = "AssemblyBase3", + Namespace = "TUnit.TestProject.AfterTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -458,20 +434,16 @@ internal static class TUnit_TestProject_AfterTests_AssemblyCleanupTests_AfterAll ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.AssemblyCleanupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.AssemblyCleanupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests)), - Name = "AssemblyCleanupTests", - Namespace = "TUnit.TestProject.AfterTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests)), + Name = "AssemblyCleanupTests", + Namespace = "TUnit.TestProject.AfterTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -538,20 +510,16 @@ internal static class TUnit_TestProject_AfterTests_AssemblyCleanupTests_AfterAll ReflectionInfo = typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests).GetMethod("AfterAllCleanUpWithContext", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::TUnit.Core.AssemblyHookContext) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.AssemblyCleanupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.AssemblyCleanupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests)), - Name = "AssemblyCleanupTests", - Namespace = "TUnit.TestProject.AfterTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests)), + Name = "AssemblyCleanupTests", + Namespace = "TUnit.TestProject.AfterTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -609,20 +577,16 @@ internal static class TUnit_TestProject_AfterTests_AssemblyCleanupTests_AfterAll ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.AssemblyCleanupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.AssemblyCleanupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests)), - Name = "AssemblyCleanupTests", - Namespace = "TUnit.TestProject.AfterTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests)), + Name = "AssemblyCleanupTests", + Namespace = "TUnit.TestProject.AfterTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -696,20 +660,16 @@ internal static class TUnit_TestProject_AfterTests_AssemblyCleanupTests_AfterAll ReflectionInfo = typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests).GetMethod("AfterAllCleanUpWithContextAndToken", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::TUnit.Core.AssemblyHookContext), typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.AssemblyCleanupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.AssemblyCleanupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests)), - Name = "AssemblyCleanupTests", - Namespace = "TUnit.TestProject.AfterTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests)), + Name = "AssemblyCleanupTests", + Namespace = "TUnit.TestProject.AfterTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -767,20 +727,16 @@ internal static class TUnit_TestProject_AfterTests_AssemblyCleanupTests_Cleanup_ ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.AssemblyCleanupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.AssemblyCleanupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests)), - Name = "AssemblyCleanupTests", - Namespace = "TUnit.TestProject.AfterTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests)), + Name = "AssemblyCleanupTests", + Namespace = "TUnit.TestProject.AfterTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -846,20 +802,16 @@ internal static class TUnit_TestProject_AfterTests_AssemblyCleanupTests_Cleanup_ ReflectionInfo = typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests).GetMethod("Cleanup", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.AssemblyCleanupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.AssemblyCleanupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests)), - Name = "AssemblyCleanupTests", - Namespace = "TUnit.TestProject.AfterTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests)), + Name = "AssemblyCleanupTests", + Namespace = "TUnit.TestProject.AfterTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -925,20 +877,16 @@ internal static class TUnit_TestProject_AfterTests_AssemblyCleanupTests_CleanupW ReflectionInfo = typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests).GetMethod("CleanupWithContext", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.Core.TestContext) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.AssemblyCleanupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.AssemblyCleanupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests)), - Name = "AssemblyCleanupTests", - Namespace = "TUnit.TestProject.AfterTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests)), + Name = "AssemblyCleanupTests", + Namespace = "TUnit.TestProject.AfterTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -1011,20 +959,16 @@ internal static class TUnit_TestProject_AfterTests_AssemblyCleanupTests_CleanupW ReflectionInfo = typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests).GetMethod("CleanupWithContext", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.AssemblyCleanupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.AssemblyCleanupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests)), - Name = "AssemblyCleanupTests", - Namespace = "TUnit.TestProject.AfterTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.AssemblyCleanupTests)), + Name = "AssemblyCleanupTests", + Namespace = "TUnit.TestProject.AfterTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, diff --git a/TUnit.Core.SourceGenerator.Tests/AssemblyBeforeTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/AssemblyBeforeTests.Test.verified.txt index 401f50ff8e..d338a0729f 100644 --- a/TUnit.Core.SourceGenerator.Tests/AssemblyBeforeTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AssemblyBeforeTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -35,20 +35,16 @@ internal static class TUnit_TestProject_BeforeTests_AssemblyBase1_BeforeAll1_Bef ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.AssemblyBase1", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.AssemblyBase1", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase1), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase1)), - Name = "AssemblyBase1", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase1), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase1)), + Name = "AssemblyBase1", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -106,20 +102,16 @@ internal static class TUnit_TestProject_BeforeTests_AssemblyBase1_BeforeEach1_Be ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.AssemblyBase1", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.AssemblyBase1", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase1), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase1)), - Name = "AssemblyBase1", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase1), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase1)), + Name = "AssemblyBase1", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -176,20 +168,16 @@ internal static class TUnit_TestProject_BeforeTests_AssemblyBase2_BeforeAll2_Bef ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.AssemblyBase2", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.AssemblyBase2", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase2), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase2)), - Name = "AssemblyBase2", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase2), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase2)), + Name = "AssemblyBase2", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -247,20 +235,16 @@ internal static class TUnit_TestProject_BeforeTests_AssemblyBase2_BeforeEach2_Be ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.AssemblyBase2", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.AssemblyBase2", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase2), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase2)), - Name = "AssemblyBase2", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase2), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase2)), + Name = "AssemblyBase2", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -317,20 +301,16 @@ internal static class TUnit_TestProject_BeforeTests_AssemblyBase3_BeforeAll3_Bef ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.AssemblyBase3", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.AssemblyBase3", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase3), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase3)), - Name = "AssemblyBase3", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase3), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase3)), + Name = "AssemblyBase3", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -388,20 +368,16 @@ internal static class TUnit_TestProject_BeforeTests_AssemblyBase3_BeforeEach3_Be ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.AssemblyBase3", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.AssemblyBase3", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase3), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase3)), - Name = "AssemblyBase3", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase3), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.AssemblyBase3)), + Name = "AssemblyBase3", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -458,20 +434,16 @@ internal static class TUnit_TestProject_BeforeTests_AssemblySetupTests_BeforeAll ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.AssemblySetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.AssemblySetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests)), - Name = "AssemblySetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests)), + Name = "AssemblySetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -538,20 +510,16 @@ internal static class TUnit_TestProject_BeforeTests_AssemblySetupTests_BeforeAll ReflectionInfo = typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests).GetMethod("BeforeAllSetUpWithContext", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::TUnit.Core.AssemblyHookContext) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.AssemblySetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.AssemblySetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests)), - Name = "AssemblySetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests)), + Name = "AssemblySetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -609,20 +577,16 @@ internal static class TUnit_TestProject_BeforeTests_AssemblySetupTests_BeforeAll ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.AssemblySetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.AssemblySetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests)), - Name = "AssemblySetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests)), + Name = "AssemblySetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -696,20 +660,16 @@ internal static class TUnit_TestProject_BeforeTests_AssemblySetupTests_BeforeAll ReflectionInfo = typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests).GetMethod("BeforeAllSetUpWithContext", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::TUnit.Core.AssemblyHookContext), typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.AssemblySetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.AssemblySetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests)), - Name = "AssemblySetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests)), + Name = "AssemblySetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -767,20 +727,16 @@ internal static class TUnit_TestProject_BeforeTests_AssemblySetupTests_Setup_Bef ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.AssemblySetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.AssemblySetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests)), - Name = "AssemblySetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests)), + Name = "AssemblySetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -846,20 +802,16 @@ internal static class TUnit_TestProject_BeforeTests_AssemblySetupTests_Setup__Ca ReflectionInfo = typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests).GetMethod("Setup", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.AssemblySetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.AssemblySetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests)), - Name = "AssemblySetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests)), + Name = "AssemblySetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -925,20 +877,16 @@ internal static class TUnit_TestProject_BeforeTests_AssemblySetupTests_SetupWith ReflectionInfo = typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests).GetMethod("SetupWithContext", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.Core.TestContext) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.AssemblySetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.AssemblySetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests)), - Name = "AssemblySetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests)), + Name = "AssemblySetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -1011,20 +959,16 @@ internal static class TUnit_TestProject_BeforeTests_AssemblySetupTests_SetupWith ReflectionInfo = typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests).GetMethod("SetupWithContext", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.AssemblySetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.AssemblySetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests)), - Name = "AssemblySetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.AssemblySetupTests)), + Name = "AssemblySetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, diff --git a/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet10_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet10_0.verified.txt index 3f1e5b2fcb..c6cf4e515e 100644 --- a/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet10_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet10_0.verified.txt @@ -15,10 +15,7 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -35,35 +32,20 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.SynchronousTest(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -86,6 +68,29 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.BasicTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.SynchronousTest(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_BasicTests_SynchronousTest_ModuleInitializer { @@ -116,10 +121,7 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "AsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -136,34 +138,20 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -186,6 +174,28 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.BasicTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_BasicTests_AsynchronousTest_ModuleInitializer { @@ -216,10 +226,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "ValueTaskAsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -236,34 +243,20 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes ReturnType = typeof(global::System.Threading.Tasks.ValueTask), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.ValueTask)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return instance.ValueTaskAsynchronousTest(); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -286,6 +279,28 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.BasicTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return instance.ValueTaskAsynchronousTest(); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_ModuleInitializer { 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 3f1e5b2fcb..c6cf4e515e 100644 --- a/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet8_0.verified.txt @@ -15,10 +15,7 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -35,35 +32,20 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.SynchronousTest(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -86,6 +68,29 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.BasicTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.SynchronousTest(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_BasicTests_SynchronousTest_ModuleInitializer { @@ -116,10 +121,7 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "AsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -136,34 +138,20 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -186,6 +174,28 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.BasicTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_BasicTests_AsynchronousTest_ModuleInitializer { @@ -216,10 +226,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "ValueTaskAsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -236,34 +243,20 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes ReturnType = typeof(global::System.Threading.Tasks.ValueTask), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.ValueTask)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return instance.ValueTaskAsynchronousTest(); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -286,6 +279,28 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.BasicTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return instance.ValueTaskAsynchronousTest(); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_ModuleInitializer { 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 3f1e5b2fcb..c6cf4e515e 100644 --- a/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet9_0.verified.txt @@ -15,10 +15,7 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -35,35 +32,20 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.SynchronousTest(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -86,6 +68,29 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.BasicTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.SynchronousTest(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_BasicTests_SynchronousTest_ModuleInitializer { @@ -116,10 +121,7 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "AsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -136,34 +138,20 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -186,6 +174,28 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.BasicTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_BasicTests_AsynchronousTest_ModuleInitializer { @@ -216,10 +226,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "ValueTaskAsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -236,34 +243,20 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes ReturnType = typeof(global::System.Threading.Tasks.ValueTask), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.ValueTask)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return instance.ValueTaskAsynchronousTest(); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -286,6 +279,28 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.BasicTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return instance.ValueTaskAsynchronousTest(); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/AsyncMethodDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/AsyncMethodDataSourceDrivenTests.Test.verified.txt index 21dc9a469f..400b7ec8e6 100644 --- a/TUnit.Core.SourceGenerator.Tests/AsyncMethodDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AsyncMethodDataSourceDrivenTests.Test.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe TestClassType = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), TestMethodName = "AsyncMethodDataSource_SingleValue", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("AsyncDataMethod") @@ -69,42 +65,20 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe ReflectionInfo = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests).GetMethod("AsyncMethodDataSource_SingleValue", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests)), - Name = "AsyncMethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests)), + Name = "AsyncMethodDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.AsyncMethodDataSource_SingleValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -127,6 +101,37 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.AsyncMethodDataSource_SingleValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMethodDataSource_SingleValue__int_ModuleInitializer { @@ -157,11 +162,7 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe TestClassType = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), TestMethodName = "AsyncMethodDataSource_Tuples", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("AsyncDataMethodWithTuples") @@ -218,42 +219,20 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe ReflectionInfo = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests).GetMethod("AsyncMethodDataSource_Tuples", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests)), - Name = "AsyncMethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests)), + Name = "AsyncMethodDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.AsyncMethodDataSource_Tuples(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -276,6 +255,37 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 2: + { + return new global::System.Threading.Tasks.ValueTask(instance.AsyncMethodDataSource_Tuples(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMethodDataSource_Tuples__int_string_ModuleInitializer { @@ -306,11 +316,7 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe TestClassType = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), TestMethodName = "AsyncMethodDataSource_Enumerable", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("AsyncEnumerableDataMethod") @@ -360,42 +366,20 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe ReflectionInfo = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests).GetMethod("AsyncMethodDataSource_Enumerable", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests)), - Name = "AsyncMethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests)), + Name = "AsyncMethodDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.AsyncMethodDataSource_Enumerable(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -418,6 +402,37 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.AsyncMethodDataSource_Enumerable(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMethodDataSource_Enumerable__int_ModuleInitializer { @@ -448,11 +463,7 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe TestClassType = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), TestMethodName = "AsyncMethodDataSource_Func", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("AsyncFuncDataMethod") @@ -502,42 +513,20 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe ReflectionInfo = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests).GetMethod("AsyncMethodDataSource_Func", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests)), - Name = "AsyncMethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests)), + Name = "AsyncMethodDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.AsyncMethodDataSource_Func(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -560,6 +549,37 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.AsyncMethodDataSource_Func(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMethodDataSource_Func__int_ModuleInitializer { @@ -590,11 +610,7 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe TestClassType = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), TestMethodName = "AsyncMethodDataSource_WithArguments", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("AsyncDataMethodWithArgs") @@ -644,42 +660,20 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe ReflectionInfo = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests).GetMethod("AsyncMethodDataSource_WithArguments", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests)), - Name = "AsyncMethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests)), + Name = "AsyncMethodDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.AsyncMethodDataSource_WithArguments(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -702,6 +696,37 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.AsyncMethodDataSource_WithArguments(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMethodDataSource_WithArguments__int_ModuleInitializer { @@ -732,11 +757,7 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe TestClassType = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), TestMethodName = "AsyncMethodDataSource_ExternalClass", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.AsyncExternalDataSource), "GetData") @@ -786,42 +807,20 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe ReflectionInfo = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests).GetMethod("AsyncMethodDataSource_ExternalClass", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests)), - Name = "AsyncMethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests)), + Name = "AsyncMethodDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.AsyncMethodDataSource_ExternalClass(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -844,6 +843,37 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.AsyncMethodDataSource_ExternalClass(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMethodDataSource_ExternalClass__string_ModuleInitializer { @@ -874,11 +904,7 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_ValueTa TestClassType = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), TestMethodName = "ValueTaskMethodDataSource_SingleValue", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("ValueTaskDataMethod") @@ -928,42 +954,20 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_ValueTa ReflectionInfo = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests).GetMethod("ValueTaskMethodDataSource_SingleValue", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests)), - Name = "AsyncMethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests)), + Name = "AsyncMethodDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.ValueTaskMethodDataSource_SingleValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -986,6 +990,37 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_ValueTa Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.ValueTaskMethodDataSource_SingleValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_ValueTaskMethodDataSource_SingleValue__int_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/AttributeTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/AttributeTests.Test.verified.txt index 0421b1ffd6..40b582e038 100644 --- a/TUnit.Core.SourceGenerator.Tests/AttributeTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AttributeTests.Test.verified.txt @@ -15,22 +15,7 @@ internal sealed class TUnit_TestProject_AttributeTests_MyTest_TestSource : globa TestClassType = typeof(global::TUnit.TestProject.AttributeTests), TestMethodName = "MyTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.AttributeTests.MixedAttribute(), - new global::TUnit.TestProject.AttributeTests.MixedAttribute("Foo"), - new global::TUnit.TestProject.AttributeTests.MixedAttribute("Foo", "Bar"), - new global::TUnit.TestProject.AttributeTests.MixedAttribute(property2: "Foo"), - new global::TUnit.TestProject.AttributeTests.MixedAttribute() -{Property = "Foo",}, - new global::TUnit.TestProject.AttributeTests.MixedAttribute("Foo") -{Property = "Bar",}, - new global::TUnit.TestProject.AttributeTests.MixedAttribute(property2: "Foo") -{Property = "Bar",}, - new global::TUnit.TestProject.AttributeTests.MixedAttribute() -{Property = "Foo",Property2 = 1,} - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -47,35 +32,20 @@ internal sealed class TUnit_TestProject_AttributeTests_MyTest_TestSource : globa ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AttributeTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AttributeTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AttributeTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AttributeTests)), - Name = "AttributeTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AttributeTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AttributeTests)), + Name = "AttributeTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.AttributeTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.MyTest(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -98,6 +68,41 @@ internal sealed class TUnit_TestProject_AttributeTests_MyTest_TestSource : globa Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.AttributeTests.MixedAttribute(), + new global::TUnit.TestProject.AttributeTests.MixedAttribute("Foo"), + new global::TUnit.TestProject.AttributeTests.MixedAttribute("Foo", "Bar"), + new global::TUnit.TestProject.AttributeTests.MixedAttribute(property2: "Foo"), + new global::TUnit.TestProject.AttributeTests.MixedAttribute() +{Property = "Foo",}, + new global::TUnit.TestProject.AttributeTests.MixedAttribute("Foo") +{Property = "Bar",}, + new global::TUnit.TestProject.AttributeTests.MixedAttribute(property2: "Foo") +{Property = "Bar",}, + new global::TUnit.TestProject.AttributeTests.MixedAttribute() +{Property = "Foo",Property2 = 1,} + ]; + } + private static global::TUnit.TestProject.AttributeTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.AttributeTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AttributeTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.MyTest(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_AttributeTests_MyTest_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet10_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet10_0.verified.txt index 3f1e5b2fcb..c6cf4e515e 100644 --- a/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet10_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet10_0.verified.txt @@ -15,10 +15,7 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -35,35 +32,20 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.SynchronousTest(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -86,6 +68,29 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.BasicTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.SynchronousTest(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_BasicTests_SynchronousTest_ModuleInitializer { @@ -116,10 +121,7 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "AsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -136,34 +138,20 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -186,6 +174,28 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.BasicTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_BasicTests_AsynchronousTest_ModuleInitializer { @@ -216,10 +226,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "ValueTaskAsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -236,34 +243,20 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes ReturnType = typeof(global::System.Threading.Tasks.ValueTask), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.ValueTask)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return instance.ValueTaskAsynchronousTest(); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -286,6 +279,28 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.BasicTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return instance.ValueTaskAsynchronousTest(); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_ModuleInitializer { 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 3f1e5b2fcb..c6cf4e515e 100644 --- a/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet8_0.verified.txt @@ -15,10 +15,7 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -35,35 +32,20 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.SynchronousTest(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -86,6 +68,29 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.BasicTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.SynchronousTest(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_BasicTests_SynchronousTest_ModuleInitializer { @@ -116,10 +121,7 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "AsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -136,34 +138,20 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -186,6 +174,28 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.BasicTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_BasicTests_AsynchronousTest_ModuleInitializer { @@ -216,10 +226,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "ValueTaskAsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -236,34 +243,20 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes ReturnType = typeof(global::System.Threading.Tasks.ValueTask), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.ValueTask)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return instance.ValueTaskAsynchronousTest(); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -286,6 +279,28 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.BasicTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return instance.ValueTaskAsynchronousTest(); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_ModuleInitializer { 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 3f1e5b2fcb..c6cf4e515e 100644 --- a/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet9_0.verified.txt @@ -15,10 +15,7 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -35,35 +32,20 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.SynchronousTest(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -86,6 +68,29 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.BasicTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.SynchronousTest(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_BasicTests_SynchronousTest_ModuleInitializer { @@ -116,10 +121,7 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "AsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -136,34 +138,20 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -186,6 +174,28 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.BasicTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_BasicTests_AsynchronousTest_ModuleInitializer { @@ -216,10 +226,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "ValueTaskAsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -236,34 +243,20 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes ReturnType = typeof(global::System.Threading.Tasks.ValueTask), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.ValueTask)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return instance.ValueTaskAsynchronousTest(); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -286,6 +279,28 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.BasicTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return instance.ValueTaskAsynchronousTest(); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/BeforeAllTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/BeforeAllTests.Test.verified.txt index 009aa1988c..a2d297b54c 100644 --- a/TUnit.Core.SourceGenerator.Tests/BeforeAllTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/BeforeAllTests.Test.verified.txt @@ -15,10 +15,7 @@ internal sealed class TUnit_TestProject_BeforeTests_SetupTests_Test1_TestSource TestClassType = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), TestMethodName = "Test1", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -35,34 +32,20 @@ internal sealed class TUnit_TestProject_BeforeTests_SetupTests_Test1_TestSource ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), - Name = "SetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), + Name = "SetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BeforeTests.SetupTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.Test1()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -85,6 +68,28 @@ internal sealed class TUnit_TestProject_BeforeTests_SetupTests_Test1_TestSource Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.BeforeTests.SetupTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.BeforeTests.SetupTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BeforeTests.SetupTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.Test1()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_BeforeTests_SetupTests_Test1_ModuleInitializer { @@ -115,10 +120,7 @@ internal sealed class TUnit_TestProject_BeforeTests_SetupTests_Test2_TestSource TestClassType = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), TestMethodName = "Test2", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -135,34 +137,20 @@ internal sealed class TUnit_TestProject_BeforeTests_SetupTests_Test2_TestSource ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), - Name = "SetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), + Name = "SetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BeforeTests.SetupTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.Test2()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -185,6 +173,28 @@ internal sealed class TUnit_TestProject_BeforeTests_SetupTests_Test2_TestSource Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.BeforeTests.SetupTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.BeforeTests.SetupTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BeforeTests.SetupTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.Test2()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_BeforeTests_SetupTests_Test2_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/BeforeTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/BeforeTests.Test.verified.txt index 009aa1988c..a2d297b54c 100644 --- a/TUnit.Core.SourceGenerator.Tests/BeforeTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/BeforeTests.Test.verified.txt @@ -15,10 +15,7 @@ internal sealed class TUnit_TestProject_BeforeTests_SetupTests_Test1_TestSource TestClassType = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), TestMethodName = "Test1", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -35,34 +32,20 @@ internal sealed class TUnit_TestProject_BeforeTests_SetupTests_Test1_TestSource ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), - Name = "SetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), + Name = "SetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BeforeTests.SetupTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.Test1()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -85,6 +68,28 @@ internal sealed class TUnit_TestProject_BeforeTests_SetupTests_Test1_TestSource Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.BeforeTests.SetupTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.BeforeTests.SetupTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BeforeTests.SetupTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.Test1()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_BeforeTests_SetupTests_Test1_ModuleInitializer { @@ -115,10 +120,7 @@ internal sealed class TUnit_TestProject_BeforeTests_SetupTests_Test2_TestSource TestClassType = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), TestMethodName = "Test2", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -135,34 +137,20 @@ internal sealed class TUnit_TestProject_BeforeTests_SetupTests_Test2_TestSource ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), - Name = "SetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), + Name = "SetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BeforeTests.SetupTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.Test2()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -185,6 +173,28 @@ internal sealed class TUnit_TestProject_BeforeTests_SetupTests_Test2_TestSource Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.BeforeTests.SetupTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.BeforeTests.SetupTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BeforeTests.SetupTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.Test2()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_BeforeTests_SetupTests_Test2_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet10_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet10_0.verified.txt index 848ae53d1e..1d02879131 100644 --- a/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet10_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet10_0.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource : TestClassType = typeof(global::TUnit.TestProject.Bugs._2971.Tests), TestMethodName = "SimpleTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Bugs._2971.SomeAttribute(typeof(global::System.Nullable<>)) - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -36,35 +32,20 @@ internal sealed class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource : ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2971.Tests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2971.Tests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._2971.Tests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2971.Tests)), - Name = "Tests", - Namespace = "TUnit.TestProject.Bugs._2971", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._2971.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2971.Tests)), + Name = "Tests", + Namespace = "TUnit.TestProject.Bugs._2971", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.Bugs._2971.Tests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.SimpleTest(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -87,6 +68,30 @@ internal sealed class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource : Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Bugs._2971.SomeAttribute(typeof(global::System.Nullable<>)) + ]; + } + private static global::TUnit.TestProject.Bugs._2971.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._2971.Tests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._2971.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.SimpleTest(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_ModuleInitializer { 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 848ae53d1e..1d02879131 100644 --- a/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet8_0.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource : TestClassType = typeof(global::TUnit.TestProject.Bugs._2971.Tests), TestMethodName = "SimpleTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Bugs._2971.SomeAttribute(typeof(global::System.Nullable<>)) - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -36,35 +32,20 @@ internal sealed class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource : ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2971.Tests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2971.Tests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._2971.Tests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2971.Tests)), - Name = "Tests", - Namespace = "TUnit.TestProject.Bugs._2971", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._2971.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2971.Tests)), + Name = "Tests", + Namespace = "TUnit.TestProject.Bugs._2971", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.Bugs._2971.Tests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.SimpleTest(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -87,6 +68,30 @@ internal sealed class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource : Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Bugs._2971.SomeAttribute(typeof(global::System.Nullable<>)) + ]; + } + private static global::TUnit.TestProject.Bugs._2971.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._2971.Tests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._2971.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.SimpleTest(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_ModuleInitializer { 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 848ae53d1e..1d02879131 100644 --- a/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet9_0.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource : TestClassType = typeof(global::TUnit.TestProject.Bugs._2971.Tests), TestMethodName = "SimpleTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Bugs._2971.SomeAttribute(typeof(global::System.Nullable<>)) - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -36,35 +32,20 @@ internal sealed class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource : ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2971.Tests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2971.Tests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._2971.Tests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2971.Tests)), - Name = "Tests", - Namespace = "TUnit.TestProject.Bugs._2971", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._2971.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2971.Tests)), + Name = "Tests", + Namespace = "TUnit.TestProject.Bugs._2971", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.Bugs._2971.Tests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.SimpleTest(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -87,6 +68,30 @@ internal sealed class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource : Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Bugs._2971.SomeAttribute(typeof(global::System.Nullable<>)) + ]; + } + private static global::TUnit.TestProject.Bugs._2971.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._2971.Tests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._2971.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.SimpleTest(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/ClassAndMethodArgumentsTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassAndMethodArgumentsTests.Test.verified.txt index 890d5a28e0..b1dd958e8d 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassAndMethodArgumentsTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ClassAndMethodArgumentsTests.Test.verified.txt @@ -15,12 +15,7 @@ internal sealed class TUnit_TestProject_ClassAndMethodArgumentsTests_Simple_Test TestClassType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), TestMethodName = "Simple", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.ArgumentsAttribute("1"), - new global::TUnit.Core.ArgumentsAttribute("2") - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] { @@ -41,46 +36,29 @@ internal sealed class TUnit_TestProject_ClassAndMethodArgumentsTests_Simple_Test ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassAndMethodArgumentsTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassAndMethodArgumentsTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata + Type = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests)), + Name = "ClassAndMethodArgumentsTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = new global::TUnit.Core.ParameterMetadata[] { - Type = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests)), - Name = "ClassAndMethodArgumentsTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = new global::TUnit.Core.ParameterMetadata[] + new global::TUnit.Core.ParameterMetadata(typeof(string)) { - new global::TUnit.Core.ParameterMetadata(typeof(string)) - { - Name = "arg1", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetConstructor(new global::System.Type[] { typeof(string) })!.GetParameters()[0] - } - }, - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Name = "arg1", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetConstructor(new global::System.Type[] { typeof(string) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.ClassAndMethodArgumentsTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.Simple()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -103,6 +81,30 @@ internal sealed class TUnit_TestProject_ClassAndMethodArgumentsTests_Simple_Test Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.ArgumentsAttribute("1"), + new global::TUnit.Core.ArgumentsAttribute("2") + ]; + } + private static global::TUnit.TestProject.ClassAndMethodArgumentsTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.ClassAndMethodArgumentsTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassAndMethodArgumentsTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.Simple()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_ClassAndMethodArgumentsTests_Simple_ModuleInitializer { @@ -133,12 +135,7 @@ internal sealed class TUnit_TestProject_ClassAndMethodArgumentsTests_WithMethodL TestClassType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), TestMethodName = "WithMethodLevel", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.ArgumentsAttribute("1"), - new global::TUnit.Core.ArgumentsAttribute("2") - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("3"), @@ -172,54 +169,29 @@ internal sealed class TUnit_TestProject_ClassAndMethodArgumentsTests_WithMethodL ReflectionInfo = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("WithMethodLevel", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassAndMethodArgumentsTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassAndMethodArgumentsTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata + Type = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests)), + Name = "ClassAndMethodArgumentsTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = new global::TUnit.Core.ParameterMetadata[] { - Type = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests)), - Name = "ClassAndMethodArgumentsTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = new global::TUnit.Core.ParameterMetadata[] + new global::TUnit.Core.ParameterMetadata(typeof(string)) { - new global::TUnit.Core.ParameterMetadata(typeof(string)) - { - Name = "arg1", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetConstructor(new global::System.Type[] { typeof(string) })!.GetParameters()[0] - } - }, - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Name = "arg1", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetConstructor(new global::System.Type[] { typeof(string) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.ClassAndMethodArgumentsTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.WithMethodLevel(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -242,6 +214,38 @@ internal sealed class TUnit_TestProject_ClassAndMethodArgumentsTests_WithMethodL Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.ArgumentsAttribute("1"), + new global::TUnit.Core.ArgumentsAttribute("2") + ]; + } + private static global::TUnit.TestProject.ClassAndMethodArgumentsTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.ClassAndMethodArgumentsTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassAndMethodArgumentsTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.WithMethodLevel(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_ClassAndMethodArgumentsTests_WithMethodLevel__string_ModuleInitializer { @@ -272,12 +276,7 @@ internal sealed class TUnit_TestProject_ClassAndMethodArgumentsTests_IgnoreParam TestClassType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), TestMethodName = "IgnoreParameters", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.ArgumentsAttribute("1"), - new global::TUnit.Core.ArgumentsAttribute("2") - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("3"), @@ -311,54 +310,29 @@ internal sealed class TUnit_TestProject_ClassAndMethodArgumentsTests_IgnoreParam ReflectionInfo = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("IgnoreParameters", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassAndMethodArgumentsTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassAndMethodArgumentsTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata + Type = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests)), + Name = "ClassAndMethodArgumentsTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = new global::TUnit.Core.ParameterMetadata[] { - Type = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests)), - Name = "ClassAndMethodArgumentsTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = new global::TUnit.Core.ParameterMetadata[] + new global::TUnit.Core.ParameterMetadata(typeof(string)) { - new global::TUnit.Core.ParameterMetadata(typeof(string)) - { - Name = "arg1", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetConstructor(new global::System.Type[] { typeof(string) })!.GetParameters()[0] - } - }, - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Name = "arg1", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetConstructor(new global::System.Type[] { typeof(string) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.ClassAndMethodArgumentsTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.IgnoreParameters(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -381,6 +355,38 @@ internal sealed class TUnit_TestProject_ClassAndMethodArgumentsTests_IgnoreParam Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.ArgumentsAttribute("1"), + new global::TUnit.Core.ArgumentsAttribute("2") + ]; + } + private static global::TUnit.TestProject.ClassAndMethodArgumentsTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.ClassAndMethodArgumentsTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassAndMethodArgumentsTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.IgnoreParameters(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_ClassAndMethodArgumentsTests_IgnoreParameters__string_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/ClassConstructorTest.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassConstructorTest.Test.verified.txt index 31c8d2d0a7..f01cce5b93 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassConstructorTest.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ClassConstructorTest.Test.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_ClassConstructorTest_Test_TestSource : g TestClassType = typeof(global::TUnit.TestProject.ClassConstructorTest), TestMethodName = "Test", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.ClassConstructorAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -36,66 +32,42 @@ internal sealed class TUnit_TestProject_ClassConstructorTest_Test_TestSource : g ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassConstructorTest", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassConstructorTest", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata + Type = typeof(global::TUnit.TestProject.ClassConstructorTest), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassConstructorTest)), + Name = "ClassConstructorTest", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = new global::TUnit.Core.ParameterMetadata[] { - Type = typeof(global::TUnit.TestProject.ClassConstructorTest), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassConstructorTest)), - Name = "ClassConstructorTest", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = new global::TUnit.Core.ParameterMetadata[] + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.DummyReferenceTypeClass)) { - new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.DummyReferenceTypeClass)) - { - Name = "dummyReferenceTypeClass", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DummyReferenceTypeClass)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.ClassConstructorTest).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.DummyReferenceTypeClass) })!.GetParameters()[0] - } - }, - Properties = new global::TUnit.Core.PropertyMetadata[] - { - new global::TUnit.Core.PropertyMetadata - { - ReflectionInfo = typeof(global::TUnit.TestProject.ClassConstructorTest).GetProperty("DummyReferenceTypeClass"), - Type = typeof(global::TUnit.TestProject.DummyReferenceTypeClass), - Name = "DummyReferenceTypeClass", - IsStatic = false, - IsNullable = false, - Getter = o => ((global::TUnit.TestProject.ClassConstructorTest)o).DummyReferenceTypeClass, - ClassMetadata = null!, - ContainingTypeMetadata = null! - } - }, - Parent = null - }; - foreach (var prop in classMetadata.Properties) + Name = "dummyReferenceTypeClass", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DummyReferenceTypeClass)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ClassConstructorTest).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.DummyReferenceTypeClass) })!.GetParameters()[0] + } + }, + Properties = new global::TUnit.Core.PropertyMetadata[] { - prop.ClassMetadata = classMetadata; - prop.ContainingTypeMetadata = classMetadata; - } - return classMetadata; + new global::TUnit.Core.PropertyMetadata + { + ReflectionInfo = typeof(global::TUnit.TestProject.ClassConstructorTest).GetProperty("DummyReferenceTypeClass"), + Type = typeof(global::TUnit.TestProject.DummyReferenceTypeClass), + Name = "DummyReferenceTypeClass", + IsStatic = false, + IsNullable = false, + Getter = o => ((global::TUnit.TestProject.ClassConstructorTest)o).DummyReferenceTypeClass, + ClassMetadata = null!, + ContainingTypeMetadata = null! + } + }, + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => - { - // 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"); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.Test(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -118,6 +90,31 @@ internal sealed class TUnit_TestProject_ClassConstructorTest_Test_TestSource : g Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.ClassConstructorAttribute() + ]; + } + private static global::TUnit.TestProject.ClassConstructorTest __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + // 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"); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassConstructorTest instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.Test(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_ClassConstructorTest_Test_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests.Test.verified.txt index 489135d2dd..d2183b4b62 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests.Test.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_DataSource_Cl TestClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), TestMethodName = "DataSource_Class", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ClassDataSourceAttribute(), @@ -48,43 +44,20 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_DataSource_Cl ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("DataSource_Class", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests)), - Name = "ClassDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests)), + Name = "ClassDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.ClassDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Class(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -107,6 +80,38 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_DataSource_Cl Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.ClassDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.ClassDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Class(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_ClassDataSourceDrivenTests_DataSource_Class__SomeAsyncDisposableClass_ModuleInitializer { @@ -137,11 +142,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_DataSource_Cl TestClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), TestMethodName = "DataSource_Class_Generic", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ClassDataSourceAttribute(), @@ -170,43 +171,20 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_DataSource_Cl ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("DataSource_Class_Generic", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests)), - Name = "ClassDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests)), + Name = "ClassDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.ClassDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Class_Generic(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -229,6 +207,38 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_DataSource_Cl Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.ClassDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.ClassDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Class_Generic(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_ClassDataSourceDrivenTests_DataSource_Class_Generic__SomeAsyncDisposableClass_ModuleInitializer { @@ -259,11 +269,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized TestClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), TestMethodName = "IsInitialized_With_1_ClassDataSource", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ClassDataSourceAttribute(), @@ -292,42 +298,20 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_1_ClassDataSource", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.InitializableClass) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests)), - Name = "ClassDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests)), + Name = "ClassDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.ClassDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.IsInitialized_With_1_ClassDataSource(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -350,6 +334,37 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.ClassDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.ClassDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.IsInitialized_With_1_ClassDataSource(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized_With_1_ClassDataSource__Ini_01E5B4B7_ModuleInitializer { @@ -380,11 +395,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized TestClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), TestMethodName = "IsInitialized_With_2_ClassDataSources", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ClassDataSourceAttribute(), @@ -420,42 +431,20 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_2_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests)), - Name = "ClassDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests)), + Name = "ClassDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.ClassDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.IsInitialized_With_2_ClassDataSources(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -478,6 +467,37 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.ClassDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.ClassDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 2: + { + return new global::System.Threading.Tasks.ValueTask(instance.IsInitialized_With_2_ClassDataSources(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized_With_2_ClassDataSources__In_52B92153_ModuleInitializer { @@ -508,11 +528,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized TestClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), TestMethodName = "IsInitialized_With_3_ClassDataSources", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ClassDataSourceAttribute(), @@ -555,42 +571,20 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_3_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass) }, null)!.GetParameters()[2] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests)), - Name = "ClassDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests)), + Name = "ClassDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.ClassDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 3: - { - return new global::System.Threading.Tasks.ValueTask(instance.IsInitialized_With_3_ClassDataSources(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -613,6 +607,37 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.ClassDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.ClassDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 3: + { + return new global::System.Threading.Tasks.ValueTask(instance.IsInitialized_With_3_ClassDataSources(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized_With_3_ClassDataSources__In_8432A34C_ModuleInitializer { @@ -643,11 +668,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized TestClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), TestMethodName = "IsInitialized_With_4_ClassDataSources", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ClassDataSourceAttribute(), @@ -697,42 +718,20 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_4_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass) }, null)!.GetParameters()[3] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests)), - Name = "ClassDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests)), + Name = "ClassDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.ClassDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 4: - { - return new global::System.Threading.Tasks.ValueTask(instance.IsInitialized_With_4_ClassDataSources(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 4 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -755,6 +754,37 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.ClassDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.ClassDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 4: + { + return new global::System.Threading.Tasks.ValueTask(instance.IsInitialized_With_4_ClassDataSources(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 4 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized_With_4_ClassDataSources__In_159CD9D1_ModuleInitializer { @@ -785,11 +815,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized TestClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), TestMethodName = "IsInitialized_With_5_ClassDataSources", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ClassDataSourceAttribute(), @@ -846,42 +872,20 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_5_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass) }, null)!.GetParameters()[4] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests)), - Name = "ClassDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests)), + Name = "ClassDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.ClassDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 5: - { - return new global::System.Threading.Tasks.ValueTask(instance.IsInitialized_With_5_ClassDataSources(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]), global::TUnit.Core.Helpers.CastHelper.Cast(args[4]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 5 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -904,6 +908,37 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.ClassDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.ClassDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 5: + { + return new global::System.Threading.Tasks.ValueTask(instance.IsInitialized_With_5_ClassDataSources(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]), global::TUnit.Core.Helpers.CastHelper.Cast(args[4]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 5 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized_With_5_ClassDataSources__In_CB437346_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests2.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests2.Test.verified.txt index b8666db842..95ce8e90e4 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests2.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests2.Test.verified.txt @@ -15,13 +15,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests2_Base_Derived TestClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2), TestMethodName = "Base_Derived1", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.ClassDataSourceAttribute(), - new global::TUnit.Core.ClassDataSourceAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] { @@ -42,47 +36,29 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests2_Base_Derived ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests2", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests2", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata + Type = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2)), + Name = "ClassDataSourceDrivenTests2", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = new global::TUnit.Core.ParameterMetadata[] { - Type = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2)), - Name = "ClassDataSourceDrivenTests2", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = new global::TUnit.Core.ParameterMetadata[] + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2.Base)) { - new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2.Base)) - { - Name = "base", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2.Base)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2.Base) })!.GetParameters()[0] - } - }, - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Name = "base", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2.Base)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2.Base) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.ClassDataSourceDrivenTests2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.Base_Derived1(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -105,6 +81,32 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests2_Base_Derived Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.ClassDataSourceAttribute(), + new global::TUnit.Core.ClassDataSourceAttribute() + ]; + } + private static global::TUnit.TestProject.ClassDataSourceDrivenTests2 __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.ClassDataSourceDrivenTests2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassDataSourceDrivenTests2 instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.Base_Derived1(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_ClassDataSourceDrivenTests2_Base_Derived1_ModuleInitializer { @@ -135,13 +137,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests2_Base_Derived TestClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2), TestMethodName = "Base_Derived2", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.ClassDataSourceAttribute(), - new global::TUnit.Core.ClassDataSourceAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] { @@ -162,47 +158,29 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests2_Base_Derived ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests2", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests2", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata + Type = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2)), + Name = "ClassDataSourceDrivenTests2", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = new global::TUnit.Core.ParameterMetadata[] { - Type = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2)), - Name = "ClassDataSourceDrivenTests2", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = new global::TUnit.Core.ParameterMetadata[] + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2.Base)) { - new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2.Base)) - { - Name = "base", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2.Base)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2.Base) })!.GetParameters()[0] - } - }, - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Name = "base", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2.Base)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2.Base) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.ClassDataSourceDrivenTests2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.Base_Derived2(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -225,6 +203,32 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests2_Base_Derived Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.ClassDataSourceAttribute(), + new global::TUnit.Core.ClassDataSourceAttribute() + ]; + } + private static global::TUnit.TestProject.ClassDataSourceDrivenTests2 __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.ClassDataSourceDrivenTests2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassDataSourceDrivenTests2 instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.Base_Derived2(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_ClassDataSourceDrivenTests2_Base_Derived2_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTestsSharedKeyed.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTestsSharedKeyed.Test.verified.txt index 7349288d72..aa697afc83 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTestsSharedKeyed.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTestsSharedKeyed.Test.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed_Da TestClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed), TestMethodName = "DataSource_Class", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ClassDataSourceAttribute() @@ -49,43 +45,20 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed_Da ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed).GetMethod("DataSource_Class", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed)), - Name = "ClassDataSourceDrivenTestsSharedKeyed", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed)), + Name = "ClassDataSourceDrivenTestsSharedKeyed", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Class(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -108,6 +81,38 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed_Da Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Class(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed_DataSource_Class__SomeAsyncDis_82F9A818_ModuleInitializer { @@ -138,11 +143,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed_Da TestClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed), TestMethodName = "DataSource_Class_Generic", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ClassDataSourceAttribute() @@ -172,43 +173,20 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed_Da ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed).GetMethod("DataSource_Class_Generic", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed)), - Name = "ClassDataSourceDrivenTestsSharedKeyed", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed)), + Name = "ClassDataSourceDrivenTestsSharedKeyed", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Class_Generic(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -231,6 +209,38 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed_Da Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Class_Generic(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed_DataSource_Class_Generic__Some_7FC73642_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.Test.verified.txt index ca178e8615..ef6dac42c1 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.Test.verified.txt @@ -25,13 +25,7 @@ internal sealed class TUnit_TestProject_ClassTupleDataSourceDrivenTests_DataSour TestClassType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests), TestMethodName = "DataSource_TupleMethod", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod"), - new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") @@ -259,126 +253,89 @@ internal sealed class TUnit_TestProject_ClassTupleDataSourceDrivenTests_DataSour ReflectionInfo = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string), typeof(bool) }, null)!.GetParameters()[2] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassTupleDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassTupleDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata + Type = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests)), + Name = "ClassTupleDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = new global::TUnit.Core.ParameterMetadata[] { - Type = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests)), - Name = "ClassTupleDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = new global::TUnit.Core.ParameterMetadata[] + new global::TUnit.Core.ParameterMetadata(typeof(int)) { - new global::TUnit.Core.ParameterMetadata(typeof(int)) - { - Name = "value", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[0] - }, - new global::TUnit.Core.ParameterMetadata(typeof(string)) - { - Name = "value2", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[1] - }, - new global::TUnit.Core.ParameterMetadata(typeof(bool)) - { - Name = "value3", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[2] - } + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[0] }, - Properties = new global::TUnit.Core.PropertyMetadata[] + new global::TUnit.Core.ParameterMetadata(typeof(string)) { - new global::TUnit.Core.PropertyMetadata - { - ReflectionInfo = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetProperty("Property1"), - Type = typeof(global::System.ValueTuple), - Name = "Property1", - IsStatic = false, - IsNullable = false, - Getter = o => ((global::TUnit.TestProject.ClassTupleDataSourceDrivenTests)o).Property1, - ClassMetadata = null!, - ContainingTypeMetadata = null! - }, - new global::TUnit.Core.PropertyMetadata - { - ReflectionInfo = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetProperty("Property2"), - Type = typeof(global::System.ValueTuple), - Name = "Property2", - IsStatic = false, - IsNullable = false, - Getter = o => ((global::TUnit.TestProject.ClassTupleDataSourceDrivenTests)o).Property2, - ClassMetadata = null!, - ContainingTypeMetadata = null! - }, - new global::TUnit.Core.PropertyMetadata - { - ReflectionInfo = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetProperty("Property3"), - Type = typeof(global::System.ValueTuple), - Name = "Property3", - IsStatic = false, - IsNullable = false, - Getter = o => ((global::TUnit.TestProject.ClassTupleDataSourceDrivenTests)o).Property3, - ClassMetadata = null!, - ContainingTypeMetadata = null! - }, - new global::TUnit.Core.PropertyMetadata - { - ReflectionInfo = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetProperty("Property4"), - Type = typeof(global::System.ValueTuple), - Name = "Property4", - IsStatic = false, - IsNullable = false, - Getter = o => ((global::TUnit.TestProject.ClassTupleDataSourceDrivenTests)o).Property4, - ClassMetadata = null!, - ContainingTypeMetadata = null! - } + Name = "value2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[1] }, - Parent = null - }; - foreach (var prop in classMetadata.Properties) + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "value3", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[2] + } + }, + Properties = new global::TUnit.Core.PropertyMetadata[] { - prop.ClassMetadata = classMetadata; - prop.ContainingTypeMetadata = classMetadata; - } - return classMetadata; + new global::TUnit.Core.PropertyMetadata + { + ReflectionInfo = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetProperty("Property1"), + Type = typeof(global::System.ValueTuple), + Name = "Property1", + IsStatic = false, + IsNullable = false, + Getter = o => ((global::TUnit.TestProject.ClassTupleDataSourceDrivenTests)o).Property1, + ClassMetadata = null!, + ContainingTypeMetadata = null! + }, + new global::TUnit.Core.PropertyMetadata + { + ReflectionInfo = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetProperty("Property2"), + Type = typeof(global::System.ValueTuple), + Name = "Property2", + IsStatic = false, + IsNullable = false, + Getter = o => ((global::TUnit.TestProject.ClassTupleDataSourceDrivenTests)o).Property2, + ClassMetadata = null!, + ContainingTypeMetadata = null! + }, + new global::TUnit.Core.PropertyMetadata + { + ReflectionInfo = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetProperty("Property3"), + Type = typeof(global::System.ValueTuple), + Name = "Property3", + IsStatic = false, + IsNullable = false, + Getter = o => ((global::TUnit.TestProject.ClassTupleDataSourceDrivenTests)o).Property3, + ClassMetadata = null!, + ContainingTypeMetadata = null! + }, + new global::TUnit.Core.PropertyMetadata + { + ReflectionInfo = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetProperty("Property4"), + Type = typeof(global::System.ValueTuple), + Name = "Property4", + IsStatic = false, + IsNullable = false, + Getter = o => ((global::TUnit.TestProject.ClassTupleDataSourceDrivenTests)o).Property4, + ClassMetadata = null!, + ContainingTypeMetadata = null! + } + }, + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.ClassTupleDataSourceDrivenTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2])) - { - Property1 = default(global::System.ValueTuple), - Property2 = default(global::System.ValueTuple), - Property3 = default(global::System.ValueTuple), - Property4 = default(global::System.ValueTuple), - }; - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 3: - { - instance.DataSource_TupleMethod(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -401,6 +358,46 @@ internal sealed class TUnit_TestProject_ClassTupleDataSourceDrivenTests_DataSour Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod"), + new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") + ]; + } + private static global::TUnit.TestProject.ClassTupleDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.ClassTupleDataSourceDrivenTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2])) + { + Property1 = default(global::System.ValueTuple), + Property2 = default(global::System.ValueTuple), + Property3 = default(global::System.ValueTuple), + Property4 = default(global::System.ValueTuple), + }; + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 3: + { + instance.DataSource_TupleMethod(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_ClassTupleDataSourceDrivenTests_DataSource_TupleMethod__int_string_bool_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/ConcreteClassTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConcreteClassTests.Test.verified.txt index 8aac896da7..925070d2e5 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConcreteClassTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConcreteClassTests.Test.verified.txt @@ -15,12 +15,7 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_ TestClassType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), TestMethodName = "SecondTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.InheritsTestsAttribute(), - new global::TUnit.Core.InheritsTestsAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -37,35 +32,20 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_ ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AbstractTests.ConcreteClass2", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AbstractTests.ConcreteClass2", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2)), - Name = "ConcreteClass2", - Namespace = "TUnit.TestProject.AbstractTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2)), + Name = "ConcreteClass2", + Namespace = "TUnit.TestProject.AbstractTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.AbstractTests.ConcreteClass2(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.SecondTest(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -88,6 +68,31 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_ Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.InheritsTestsAttribute(), + new global::TUnit.Core.InheritsTestsAttribute() + ]; + } + private static global::TUnit.TestProject.AbstractTests.ConcreteClass2 __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.AbstractTests.ConcreteClass2(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AbstractTests.ConcreteClass2 instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.SecondTest(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_ModuleInitializer { @@ -118,12 +123,7 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_AssertClass TestClassType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), TestMethodName = "AssertClassName", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.InheritsTestsAttribute(), - new global::TUnit.Core.InheritsTestsAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -140,34 +140,20 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_AssertClass ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AbstractTests.ConcreteClass2", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AbstractTests.ConcreteClass2", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2)), - Name = "ConcreteClass2", - Namespace = "TUnit.TestProject.AbstractTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2)), + Name = "ConcreteClass2", + Namespace = "TUnit.TestProject.AbstractTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.AbstractTests.ConcreteClass2(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.AssertClassName()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -190,6 +176,30 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_AssertClass Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.InheritsTestsAttribute(), + new global::TUnit.Core.InheritsTestsAttribute() + ]; + } + private static global::TUnit.TestProject.AbstractTests.ConcreteClass2 __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.AbstractTests.ConcreteClass2(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AbstractTests.ConcreteClass2 instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.AssertClassName()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_AbstractTests_ConcreteClass2_AssertClassName_ModuleInitializer { @@ -220,11 +230,7 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClass TestClassType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1), TestMethodName = "AssertClassName", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.InheritsTestsAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -241,34 +247,20 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClass ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AbstractTests.ConcreteClass1", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AbstractTests.ConcreteClass1", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1)), - Name = "ConcreteClass1", - Namespace = "TUnit.TestProject.AbstractTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1)), + Name = "ConcreteClass1", + Namespace = "TUnit.TestProject.AbstractTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.AbstractTests.ConcreteClass1(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.AssertClassName()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -291,6 +283,29 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClass Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.InheritsTestsAttribute() + ]; + } + private static global::TUnit.TestProject.AbstractTests.ConcreteClass1 __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.AbstractTests.ConcreteClass1(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AbstractTests.ConcreteClass1 instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.AssertClassName()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClassName_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.BasicTest_WithConflictingNamespace.DotNet10_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.BasicTest_WithConflictingNamespace.DotNet10_0.verified.txt index 3f1e5b2fcb..c6cf4e515e 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.BasicTest_WithConflictingNamespace.DotNet10_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.BasicTest_WithConflictingNamespace.DotNet10_0.verified.txt @@ -15,10 +15,7 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -35,35 +32,20 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.SynchronousTest(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -86,6 +68,29 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.BasicTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.SynchronousTest(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_BasicTests_SynchronousTest_ModuleInitializer { @@ -116,10 +121,7 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "AsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -136,34 +138,20 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -186,6 +174,28 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.BasicTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_BasicTests_AsynchronousTest_ModuleInitializer { @@ -216,10 +226,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "ValueTaskAsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -236,34 +243,20 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes ReturnType = typeof(global::System.Threading.Tasks.ValueTask), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.ValueTask)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return instance.ValueTaskAsynchronousTest(); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -286,6 +279,28 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.BasicTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return instance.ValueTaskAsynchronousTest(); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.BasicTest_WithConflictingNamespace.DotNet8_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.BasicTest_WithConflictingNamespace.DotNet8_0.verified.txt index 3f1e5b2fcb..c6cf4e515e 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.BasicTest_WithConflictingNamespace.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.BasicTest_WithConflictingNamespace.DotNet8_0.verified.txt @@ -15,10 +15,7 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -35,35 +32,20 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.SynchronousTest(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -86,6 +68,29 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.BasicTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.SynchronousTest(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_BasicTests_SynchronousTest_ModuleInitializer { @@ -116,10 +121,7 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "AsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -136,34 +138,20 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -186,6 +174,28 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.BasicTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_BasicTests_AsynchronousTest_ModuleInitializer { @@ -216,10 +226,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "ValueTaskAsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -236,34 +243,20 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes ReturnType = typeof(global::System.Threading.Tasks.ValueTask), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.ValueTask)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return instance.ValueTaskAsynchronousTest(); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -286,6 +279,28 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.BasicTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return instance.ValueTaskAsynchronousTest(); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.BasicTest_WithConflictingNamespace.DotNet9_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.BasicTest_WithConflictingNamespace.DotNet9_0.verified.txt index 3f1e5b2fcb..c6cf4e515e 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.BasicTest_WithConflictingNamespace.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.BasicTest_WithConflictingNamespace.DotNet9_0.verified.txt @@ -15,10 +15,7 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -35,35 +32,20 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.SynchronousTest(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -86,6 +68,29 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.BasicTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.SynchronousTest(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_BasicTests_SynchronousTest_ModuleInitializer { @@ -116,10 +121,7 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "AsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -136,34 +138,20 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -186,6 +174,28 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.BasicTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_BasicTests_AsynchronousTest_ModuleInitializer { @@ -216,10 +226,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "ValueTaskAsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -236,34 +243,20 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes ReturnType = typeof(global::System.Threading.Tasks.ValueTask), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.ValueTask)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return instance.ValueTaskAsynchronousTest(); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -286,6 +279,28 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.BasicTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return instance.ValueTaskAsynchronousTest(); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.DataDrivenTest_WithConflictingNamespace.DotNet10_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.DataDrivenTest_WithConflictingNamespace.DotNet10_0.verified.txt index 1f79ca1e5f..51e0a0b0a8 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.DataDrivenTest_WithConflictingNamespace.DotNet10_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.DataDrivenTest_WithConflictingNamespace.DotNet10_0.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_T TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "DataSource_Method", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1), @@ -50,43 +46,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_T ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -109,6 +82,38 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_T Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_ModuleInitializer { @@ -139,11 +144,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_s TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "DataSource_Method", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1, "String"), @@ -181,43 +182,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_s ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 2: - { - instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -240,6 +218,38 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_s Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 2: + { + instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_string_ModuleInitializer { @@ -270,11 +280,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_Test TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "EnumValue", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.One), @@ -305,43 +311,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_Test ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("EnumValue", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.TestEnum) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.EnumValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -364,6 +347,38 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_Test Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.EnumValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_ModuleInitializer { @@ -394,11 +409,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NullValue__string__TestS TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "NullValue", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(null), @@ -427,43 +438,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NullValue__string__TestS ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("NullValue", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.NullValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -486,6 +474,38 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NullValue__string__TestS Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.NullValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataDrivenTests_NullValue__string__ModuleInitializer { @@ -516,11 +536,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EmptyString__string__Tes TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "EmptyString", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(""), @@ -549,43 +565,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EmptyString__string__Tes ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("EmptyString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.EmptyString(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -608,6 +601,38 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EmptyString__string__Tes Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.EmptyString(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataDrivenTests_EmptyString__string__ModuleInitializer { @@ -638,11 +663,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "NonEmptyString", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("Foo bar!"), @@ -671,43 +692,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("NonEmptyString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.NonEmptyString(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -730,6 +728,38 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.NonEmptyString(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ModuleInitializer { @@ -760,11 +790,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__Tes TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "BooleanString", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(null), @@ -795,43 +821,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__Tes ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("BooleanString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool?) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.BooleanString(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -854,6 +857,38 @@ internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__Tes Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.BooleanString(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataDrivenTests_BooleanString__bool__ModuleInitializer { @@ -884,11 +919,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "Type", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(typeof(object)), @@ -917,43 +948,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("Type", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Type) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.Type(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -976,6 +984,38 @@ internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.Type(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataDrivenTests_Type__Type_ModuleInitializer { @@ -1006,11 +1046,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___Test TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "IntegerArray", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(new[] { 1, 2, 3 }), @@ -1039,43 +1075,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___Test ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("IntegerArray", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int[]) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.IntegerArray(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1098,6 +1111,38 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___Test Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.IntegerArray(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataDrivenTests_IntegerArray__int___ModuleInitializer { @@ -1128,11 +1173,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSou TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "IntMaxValue", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(2147483647), @@ -1161,43 +1202,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSou ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("IntMaxValue", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.IntMaxValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1220,6 +1238,38 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSou Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.IntMaxValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.DataDrivenTest_WithConflictingNamespace.DotNet8_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.DataDrivenTest_WithConflictingNamespace.DotNet8_0.verified.txt index 1f79ca1e5f..51e0a0b0a8 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.DataDrivenTest_WithConflictingNamespace.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.DataDrivenTest_WithConflictingNamespace.DotNet8_0.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_T TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "DataSource_Method", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1), @@ -50,43 +46,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_T ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -109,6 +82,38 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_T Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_ModuleInitializer { @@ -139,11 +144,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_s TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "DataSource_Method", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1, "String"), @@ -181,43 +182,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_s ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 2: - { - instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -240,6 +218,38 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_s Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 2: + { + instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_string_ModuleInitializer { @@ -270,11 +280,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_Test TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "EnumValue", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.One), @@ -305,43 +311,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_Test ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("EnumValue", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.TestEnum) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.EnumValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -364,6 +347,38 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_Test Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.EnumValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_ModuleInitializer { @@ -394,11 +409,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NullValue__string__TestS TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "NullValue", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(null), @@ -427,43 +438,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NullValue__string__TestS ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("NullValue", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.NullValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -486,6 +474,38 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NullValue__string__TestS Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.NullValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataDrivenTests_NullValue__string__ModuleInitializer { @@ -516,11 +536,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EmptyString__string__Tes TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "EmptyString", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(""), @@ -549,43 +565,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EmptyString__string__Tes ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("EmptyString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.EmptyString(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -608,6 +601,38 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EmptyString__string__Tes Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.EmptyString(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataDrivenTests_EmptyString__string__ModuleInitializer { @@ -638,11 +663,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "NonEmptyString", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("Foo bar!"), @@ -671,43 +692,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("NonEmptyString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.NonEmptyString(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -730,6 +728,38 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.NonEmptyString(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ModuleInitializer { @@ -760,11 +790,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__Tes TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "BooleanString", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(null), @@ -795,43 +821,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__Tes ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("BooleanString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool?) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.BooleanString(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -854,6 +857,38 @@ internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__Tes Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.BooleanString(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataDrivenTests_BooleanString__bool__ModuleInitializer { @@ -884,11 +919,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "Type", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(typeof(object)), @@ -917,43 +948,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("Type", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Type) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.Type(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -976,6 +984,38 @@ internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.Type(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataDrivenTests_Type__Type_ModuleInitializer { @@ -1006,11 +1046,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___Test TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "IntegerArray", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(new[] { 1, 2, 3 }), @@ -1039,43 +1075,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___Test ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("IntegerArray", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int[]) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.IntegerArray(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1098,6 +1111,38 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___Test Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.IntegerArray(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataDrivenTests_IntegerArray__int___ModuleInitializer { @@ -1128,11 +1173,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSou TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "IntMaxValue", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(2147483647), @@ -1161,43 +1202,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSou ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("IntMaxValue", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.IntMaxValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1220,6 +1238,38 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSou Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.IntMaxValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.DataDrivenTest_WithConflictingNamespace.DotNet9_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.DataDrivenTest_WithConflictingNamespace.DotNet9_0.verified.txt index 1f79ca1e5f..51e0a0b0a8 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.DataDrivenTest_WithConflictingNamespace.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.DataDrivenTest_WithConflictingNamespace.DotNet9_0.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_T TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "DataSource_Method", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1), @@ -50,43 +46,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_T ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -109,6 +82,38 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_T Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_ModuleInitializer { @@ -139,11 +144,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_s TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "DataSource_Method", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1, "String"), @@ -181,43 +182,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_s ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 2: - { - instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -240,6 +218,38 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_s Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 2: + { + instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_string_ModuleInitializer { @@ -270,11 +280,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_Test TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "EnumValue", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.One), @@ -305,43 +311,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_Test ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("EnumValue", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.TestEnum) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.EnumValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -364,6 +347,38 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_Test Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.EnumValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_ModuleInitializer { @@ -394,11 +409,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NullValue__string__TestS TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "NullValue", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(null), @@ -427,43 +438,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NullValue__string__TestS ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("NullValue", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.NullValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -486,6 +474,38 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NullValue__string__TestS Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.NullValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataDrivenTests_NullValue__string__ModuleInitializer { @@ -516,11 +536,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EmptyString__string__Tes TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "EmptyString", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(""), @@ -549,43 +565,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EmptyString__string__Tes ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("EmptyString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.EmptyString(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -608,6 +601,38 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EmptyString__string__Tes Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.EmptyString(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataDrivenTests_EmptyString__string__ModuleInitializer { @@ -638,11 +663,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "NonEmptyString", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("Foo bar!"), @@ -671,43 +692,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("NonEmptyString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.NonEmptyString(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -730,6 +728,38 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.NonEmptyString(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ModuleInitializer { @@ -760,11 +790,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__Tes TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "BooleanString", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(null), @@ -795,43 +821,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__Tes ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("BooleanString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool?) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.BooleanString(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -854,6 +857,38 @@ internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__Tes Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.BooleanString(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataDrivenTests_BooleanString__bool__ModuleInitializer { @@ -884,11 +919,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "Type", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(typeof(object)), @@ -917,43 +948,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("Type", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Type) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.Type(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -976,6 +984,38 @@ internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.Type(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataDrivenTests_Type__Type_ModuleInitializer { @@ -1006,11 +1046,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___Test TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "IntegerArray", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(new[] { 1, 2, 3 }), @@ -1039,43 +1075,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___Test ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("IntegerArray", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int[]) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.IntegerArray(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1098,6 +1111,38 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___Test Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.IntegerArray(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataDrivenTests_IntegerArray__int___ModuleInitializer { @@ -1128,11 +1173,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSou TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "IntMaxValue", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(2147483647), @@ -1161,43 +1202,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSou ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("IntMaxValue", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.IntMaxValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1220,6 +1238,38 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSou Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.IntMaxValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.HooksTest_WithConflictingNamespace.DotNet10_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.HooksTest_WithConflictingNamespace.DotNet10_0.verified.txt index 791c63afbb..5f1a6647fd 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.HooksTest_WithConflictingNamespace.DotNet10_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.HooksTest_WithConflictingNamespace.DotNet10_0.verified.txt @@ -34,20 +34,16 @@ internal static class TUnit_TestProject_BeforeTests_Base1_BeforeAll1_Before_Clas ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base1", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base1", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.Base1), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base1)), - Name = "Base1", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.Base1), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base1)), + Name = "Base1", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -105,20 +101,16 @@ internal static class TUnit_TestProject_BeforeTests_Base1_BeforeEach1_Before_Tes ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base1", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base1", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.Base1), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base1)), - Name = "Base1", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.Base1), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base1)), + Name = "Base1", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -174,20 +166,16 @@ internal static class TUnit_TestProject_BeforeTests_Base2_BeforeAll2_Before_Clas ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base2", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base2", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.Base2), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base2)), - Name = "Base2", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.Base2), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base2)), + Name = "Base2", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -245,20 +233,16 @@ internal static class TUnit_TestProject_BeforeTests_Base2_BeforeEach2_Before_Tes ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base2", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base2", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.Base2), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base2)), - Name = "Base2", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.Base2), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base2)), + Name = "Base2", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -314,20 +298,16 @@ internal static class TUnit_TestProject_BeforeTests_Base3_BeforeAll3_Before_Clas ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base3", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base3", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.Base3), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base3)), - Name = "Base3", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.Base3), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base3)), + Name = "Base3", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -385,20 +365,16 @@ internal static class TUnit_TestProject_BeforeTests_Base3_BeforeEach3_Before_Tes ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base3", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base3", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.Base3), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base3)), - Name = "Base3", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.Base3), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base3)), + Name = "Base3", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -454,20 +430,16 @@ internal static class TUnit_TestProject_BeforeTests_SetupTests_BeforeAllSetUp_Be ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), - Name = "SetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), + Name = "SetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -533,20 +505,16 @@ internal static class TUnit_TestProject_BeforeTests_SetupTests_BeforeAllSetUpWit ReflectionInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("BeforeAllSetUpWithContext", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::TUnit.Core.ClassHookContext) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), - Name = "SetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), + Name = "SetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -612,20 +580,16 @@ internal static class TUnit_TestProject_BeforeTests_SetupTests_BeforeAllSetUp__C ReflectionInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("BeforeAllSetUp", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), - Name = "SetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), + Name = "SetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -698,20 +662,16 @@ internal static class TUnit_TestProject_BeforeTests_SetupTests_BeforeAllSetUpWit ReflectionInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("BeforeAllSetUpWithContext", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::TUnit.Core.ClassHookContext), typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), - Name = "SetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), + Name = "SetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -769,20 +729,16 @@ internal static class TUnit_TestProject_BeforeTests_SetupTests_Setup_Before_Test ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), - Name = "SetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), + Name = "SetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -848,20 +804,16 @@ internal static class TUnit_TestProject_BeforeTests_SetupTests_Setup__Cancellati ReflectionInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("Setup", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), - Name = "SetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), + Name = "SetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -927,20 +879,16 @@ internal static class TUnit_TestProject_BeforeTests_SetupTests_SetupWithContext_ ReflectionInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("SetupWithContext", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.Core.TestContext) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), - Name = "SetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), + Name = "SetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -1013,20 +961,16 @@ internal static class TUnit_TestProject_BeforeTests_SetupTests_SetupWithContext_ ReflectionInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("SetupWithContext", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), - Name = "SetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), + Name = "SetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.HooksTest_WithConflictingNamespace.DotNet8_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.HooksTest_WithConflictingNamespace.DotNet8_0.verified.txt index 791c63afbb..5f1a6647fd 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.HooksTest_WithConflictingNamespace.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.HooksTest_WithConflictingNamespace.DotNet8_0.verified.txt @@ -34,20 +34,16 @@ internal static class TUnit_TestProject_BeforeTests_Base1_BeforeAll1_Before_Clas ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base1", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base1", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.Base1), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base1)), - Name = "Base1", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.Base1), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base1)), + Name = "Base1", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -105,20 +101,16 @@ internal static class TUnit_TestProject_BeforeTests_Base1_BeforeEach1_Before_Tes ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base1", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base1", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.Base1), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base1)), - Name = "Base1", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.Base1), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base1)), + Name = "Base1", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -174,20 +166,16 @@ internal static class TUnit_TestProject_BeforeTests_Base2_BeforeAll2_Before_Clas ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base2", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base2", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.Base2), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base2)), - Name = "Base2", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.Base2), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base2)), + Name = "Base2", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -245,20 +233,16 @@ internal static class TUnit_TestProject_BeforeTests_Base2_BeforeEach2_Before_Tes ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base2", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base2", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.Base2), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base2)), - Name = "Base2", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.Base2), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base2)), + Name = "Base2", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -314,20 +298,16 @@ internal static class TUnit_TestProject_BeforeTests_Base3_BeforeAll3_Before_Clas ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base3", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base3", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.Base3), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base3)), - Name = "Base3", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.Base3), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base3)), + Name = "Base3", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -385,20 +365,16 @@ internal static class TUnit_TestProject_BeforeTests_Base3_BeforeEach3_Before_Tes ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base3", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base3", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.Base3), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base3)), - Name = "Base3", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.Base3), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base3)), + Name = "Base3", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -454,20 +430,16 @@ internal static class TUnit_TestProject_BeforeTests_SetupTests_BeforeAllSetUp_Be ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), - Name = "SetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), + Name = "SetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -533,20 +505,16 @@ internal static class TUnit_TestProject_BeforeTests_SetupTests_BeforeAllSetUpWit ReflectionInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("BeforeAllSetUpWithContext", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::TUnit.Core.ClassHookContext) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), - Name = "SetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), + Name = "SetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -612,20 +580,16 @@ internal static class TUnit_TestProject_BeforeTests_SetupTests_BeforeAllSetUp__C ReflectionInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("BeforeAllSetUp", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), - Name = "SetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), + Name = "SetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -698,20 +662,16 @@ internal static class TUnit_TestProject_BeforeTests_SetupTests_BeforeAllSetUpWit ReflectionInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("BeforeAllSetUpWithContext", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::TUnit.Core.ClassHookContext), typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), - Name = "SetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), + Name = "SetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -769,20 +729,16 @@ internal static class TUnit_TestProject_BeforeTests_SetupTests_Setup_Before_Test ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), - Name = "SetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), + Name = "SetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -848,20 +804,16 @@ internal static class TUnit_TestProject_BeforeTests_SetupTests_Setup__Cancellati ReflectionInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("Setup", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), - Name = "SetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), + Name = "SetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -927,20 +879,16 @@ internal static class TUnit_TestProject_BeforeTests_SetupTests_SetupWithContext_ ReflectionInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("SetupWithContext", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.Core.TestContext) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), - Name = "SetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), + Name = "SetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -1013,20 +961,16 @@ internal static class TUnit_TestProject_BeforeTests_SetupTests_SetupWithContext_ ReflectionInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("SetupWithContext", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), - Name = "SetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), + Name = "SetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.HooksTest_WithConflictingNamespace.DotNet9_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.HooksTest_WithConflictingNamespace.DotNet9_0.verified.txt index 791c63afbb..5f1a6647fd 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.HooksTest_WithConflictingNamespace.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.HooksTest_WithConflictingNamespace.DotNet9_0.verified.txt @@ -34,20 +34,16 @@ internal static class TUnit_TestProject_BeforeTests_Base1_BeforeAll1_Before_Clas ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base1", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base1", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.Base1), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base1)), - Name = "Base1", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.Base1), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base1)), + Name = "Base1", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -105,20 +101,16 @@ internal static class TUnit_TestProject_BeforeTests_Base1_BeforeEach1_Before_Tes ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base1", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base1", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.Base1), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base1)), - Name = "Base1", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.Base1), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base1)), + Name = "Base1", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -174,20 +166,16 @@ internal static class TUnit_TestProject_BeforeTests_Base2_BeforeAll2_Before_Clas ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base2", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base2", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.Base2), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base2)), - Name = "Base2", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.Base2), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base2)), + Name = "Base2", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -245,20 +233,16 @@ internal static class TUnit_TestProject_BeforeTests_Base2_BeforeEach2_Before_Tes ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base2", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base2", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.Base2), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base2)), - Name = "Base2", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.Base2), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base2)), + Name = "Base2", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -314,20 +298,16 @@ internal static class TUnit_TestProject_BeforeTests_Base3_BeforeAll3_Before_Clas ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base3", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base3", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.Base3), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base3)), - Name = "Base3", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.Base3), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base3)), + Name = "Base3", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -385,20 +365,16 @@ internal static class TUnit_TestProject_BeforeTests_Base3_BeforeEach3_Before_Tes ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base3", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.Base3", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.Base3), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base3)), - Name = "Base3", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.Base3), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.Base3)), + Name = "Base3", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -454,20 +430,16 @@ internal static class TUnit_TestProject_BeforeTests_SetupTests_BeforeAllSetUp_Be ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), - Name = "SetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), + Name = "SetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -533,20 +505,16 @@ internal static class TUnit_TestProject_BeforeTests_SetupTests_BeforeAllSetUpWit ReflectionInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("BeforeAllSetUpWithContext", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::TUnit.Core.ClassHookContext) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), - Name = "SetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), + Name = "SetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -612,20 +580,16 @@ internal static class TUnit_TestProject_BeforeTests_SetupTests_BeforeAllSetUp__C ReflectionInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("BeforeAllSetUp", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), - Name = "SetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), + Name = "SetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -698,20 +662,16 @@ internal static class TUnit_TestProject_BeforeTests_SetupTests_BeforeAllSetUpWit ReflectionInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("BeforeAllSetUpWithContext", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::TUnit.Core.ClassHookContext), typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), - Name = "SetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), + Name = "SetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -769,20 +729,16 @@ internal static class TUnit_TestProject_BeforeTests_SetupTests_Setup_Before_Test ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), - Name = "SetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), + Name = "SetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -848,20 +804,16 @@ internal static class TUnit_TestProject_BeforeTests_SetupTests_Setup__Cancellati ReflectionInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("Setup", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), - Name = "SetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), + Name = "SetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -927,20 +879,16 @@ internal static class TUnit_TestProject_BeforeTests_SetupTests_SetupWithContext_ ReflectionInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("SetupWithContext", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.Core.TestContext) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), - Name = "SetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), + Name = "SetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -1013,20 +961,16 @@ internal static class TUnit_TestProject_BeforeTests_SetupTests_SetupWithContext_ ReflectionInfo = typeof(global::TUnit.TestProject.BeforeTests.SetupTests).GetMethod("SetupWithContext", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), - Name = "SetupTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), + Name = "SetupTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MatrixTest_WithConflictingNamespace.DotNet10_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MatrixTest_WithConflictingNamespace.DotNet10_0.verified.txt index 02f4777aa0..e7e4b8f9ea 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MatrixTest_WithConflictingNamespace.DotNet10_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MatrixTest_WithConflictingNamespace.DotNet10_0.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_b TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "MatrixTest_One", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -62,42 +58,20 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_b ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(int), typeof(bool) }, null)!.GetParameters()[2] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 3: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_One(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -120,6 +94,37 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_b Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 3: + { + return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_One(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_bool_ModuleInitializer { @@ -150,11 +155,7 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_ TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "MatrixTest_Two", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -204,42 +205,20 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_ ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int), typeof(int), typeof(bool) }, null)!.GetParameters()[3] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 4: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_Two(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 4 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -262,6 +241,37 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_ Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 4: + { + return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_Two(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 4 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_bool_ModuleInitializer { @@ -292,11 +302,7 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnu TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "MatrixTest_Enum", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -339,42 +345,20 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnu ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Enum", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(TestEnum), typeof(TestEnum?) }, null)!.GetParameters()[2] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 3: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_Enum(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -397,6 +381,37 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnu Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 3: + { + return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_Enum(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnum_TestEnum__ModuleInitializer { @@ -427,11 +442,7 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bo TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "AutoGenerateBools", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -467,42 +478,20 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bo ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("AutoGenerateBools", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(bool) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.AutoGenerateBools(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -525,6 +514,37 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bo Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 2: + { + return new global::System.Threading.Tasks.ValueTask(instance.AutoGenerateBools(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bool_ModuleInitializer { @@ -555,11 +575,7 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_b TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "AutoGenerateBools2", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -595,42 +611,20 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_b ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("AutoGenerateBools2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(bool?) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.AutoGenerateBools2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -653,6 +647,37 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_b Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 2: + { + return new global::System.Threading.Tasks.ValueTask(instance.AutoGenerateBools2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_bool__ModuleInitializer { @@ -683,11 +708,7 @@ internal sealed class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_Te TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "ImplicitConversion", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -723,42 +744,20 @@ internal sealed class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_Te ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("ImplicitConversion", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(OneOf), typeof(bool) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.ImplicitConversion(global::TUnit.Core.Helpers.CastHelper.Cast>(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -781,6 +780,37 @@ internal sealed class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_Te Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 2: + { + return new global::System.Threading.Tasks.ValueTask(instance.ImplicitConversion(global::TUnit.Core.Helpers.CastHelper.Cast>(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool_ModuleInitializer { @@ -811,11 +841,7 @@ internal sealed class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrix TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "ExcludingAutoGeneratedMatrixValues", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -851,42 +877,20 @@ internal sealed class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrix ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("ExcludingAutoGeneratedMatrixValues", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), typeof(bool) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.ExcludingAutoGeneratedMatrixValues(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -909,6 +913,37 @@ internal sealed class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrix Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 2: + { + return new global::System.Threading.Tasks.ValueTask(instance.ExcludingAutoGeneratedMatrixValues(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool_ModuleInitializer { @@ -939,11 +974,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method1__int_TestSource : gl TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Method1", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -972,42 +1003,20 @@ internal sealed class TUnit_TestProject_MatrixTests_Method1__int_TestSource : gl ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method1", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Method1(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1030,6 +1039,37 @@ internal sealed class TUnit_TestProject_MatrixTests_Method1__int_TestSource : gl Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.Method1(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_Method1__int_ModuleInitializer { @@ -1060,11 +1100,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method2__int_TestSource : gl TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Method2", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1093,42 +1129,20 @@ internal sealed class TUnit_TestProject_MatrixTests_Method2__int_TestSource : gl ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Method2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1151,6 +1165,37 @@ internal sealed class TUnit_TestProject_MatrixTests_Method2__int_TestSource : gl Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.Method2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_Method2__int_ModuleInitializer { @@ -1181,11 +1226,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : gl TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Method3", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1214,42 +1255,20 @@ internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : gl ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method3", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Method3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1272,6 +1291,37 @@ internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : gl Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.Method3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_Method3__int_ModuleInitializer { @@ -1302,11 +1352,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : gl TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Method4", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1335,42 +1381,20 @@ internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : gl ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method4", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Method4(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1393,6 +1417,37 @@ internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : gl Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.Method4(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_Method4__int_ModuleInitializer { @@ -1423,14 +1478,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSourc TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Exclusion", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.MatrixExclusionAttribute(1, 1), - new global::TUnit.Core.MatrixExclusionAttribute(2, 2), - new global::TUnit.Core.MatrixExclusionAttribute(3, 3), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1466,42 +1514,20 @@ internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSourc ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Exclusion", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.Exclusion(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1524,6 +1550,40 @@ internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSourc Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.MatrixExclusionAttribute(1, 1), + new global::TUnit.Core.MatrixExclusionAttribute(2, 2), + new global::TUnit.Core.MatrixExclusionAttribute(3, 3), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 2: + { + return new global::System.Threading.Tasks.ValueTask(instance.Exclusion(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_Exclusion__int_int_ModuleInitializer { @@ -1554,11 +1614,7 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParamet TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1594,42 +1650,20 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParamet ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool), typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1652,6 +1686,37 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParamet Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 2: + { + return new global::System.Threading.Tasks.ValueTask(instance.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__boo_38BEEE8F_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MatrixTest_WithConflictingNamespace.DotNet8_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MatrixTest_WithConflictingNamespace.DotNet8_0.verified.txt index 02f4777aa0..e7e4b8f9ea 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MatrixTest_WithConflictingNamespace.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MatrixTest_WithConflictingNamespace.DotNet8_0.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_b TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "MatrixTest_One", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -62,42 +58,20 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_b ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(int), typeof(bool) }, null)!.GetParameters()[2] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 3: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_One(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -120,6 +94,37 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_b Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 3: + { + return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_One(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_bool_ModuleInitializer { @@ -150,11 +155,7 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_ TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "MatrixTest_Two", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -204,42 +205,20 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_ ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int), typeof(int), typeof(bool) }, null)!.GetParameters()[3] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 4: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_Two(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 4 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -262,6 +241,37 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_ Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 4: + { + return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_Two(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 4 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_bool_ModuleInitializer { @@ -292,11 +302,7 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnu TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "MatrixTest_Enum", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -339,42 +345,20 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnu ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Enum", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(TestEnum), typeof(TestEnum?) }, null)!.GetParameters()[2] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 3: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_Enum(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -397,6 +381,37 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnu Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 3: + { + return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_Enum(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnum_TestEnum__ModuleInitializer { @@ -427,11 +442,7 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bo TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "AutoGenerateBools", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -467,42 +478,20 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bo ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("AutoGenerateBools", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(bool) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.AutoGenerateBools(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -525,6 +514,37 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bo Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 2: + { + return new global::System.Threading.Tasks.ValueTask(instance.AutoGenerateBools(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bool_ModuleInitializer { @@ -555,11 +575,7 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_b TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "AutoGenerateBools2", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -595,42 +611,20 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_b ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("AutoGenerateBools2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(bool?) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.AutoGenerateBools2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -653,6 +647,37 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_b Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 2: + { + return new global::System.Threading.Tasks.ValueTask(instance.AutoGenerateBools2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_bool__ModuleInitializer { @@ -683,11 +708,7 @@ internal sealed class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_Te TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "ImplicitConversion", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -723,42 +744,20 @@ internal sealed class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_Te ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("ImplicitConversion", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(OneOf), typeof(bool) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.ImplicitConversion(global::TUnit.Core.Helpers.CastHelper.Cast>(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -781,6 +780,37 @@ internal sealed class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_Te Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 2: + { + return new global::System.Threading.Tasks.ValueTask(instance.ImplicitConversion(global::TUnit.Core.Helpers.CastHelper.Cast>(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool_ModuleInitializer { @@ -811,11 +841,7 @@ internal sealed class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrix TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "ExcludingAutoGeneratedMatrixValues", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -851,42 +877,20 @@ internal sealed class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrix ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("ExcludingAutoGeneratedMatrixValues", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), typeof(bool) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.ExcludingAutoGeneratedMatrixValues(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -909,6 +913,37 @@ internal sealed class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrix Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 2: + { + return new global::System.Threading.Tasks.ValueTask(instance.ExcludingAutoGeneratedMatrixValues(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool_ModuleInitializer { @@ -939,11 +974,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method1__int_TestSource : gl TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Method1", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -972,42 +1003,20 @@ internal sealed class TUnit_TestProject_MatrixTests_Method1__int_TestSource : gl ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method1", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Method1(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1030,6 +1039,37 @@ internal sealed class TUnit_TestProject_MatrixTests_Method1__int_TestSource : gl Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.Method1(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_Method1__int_ModuleInitializer { @@ -1060,11 +1100,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method2__int_TestSource : gl TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Method2", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1093,42 +1129,20 @@ internal sealed class TUnit_TestProject_MatrixTests_Method2__int_TestSource : gl ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Method2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1151,6 +1165,37 @@ internal sealed class TUnit_TestProject_MatrixTests_Method2__int_TestSource : gl Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.Method2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_Method2__int_ModuleInitializer { @@ -1181,11 +1226,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : gl TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Method3", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1214,42 +1255,20 @@ internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : gl ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method3", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Method3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1272,6 +1291,37 @@ internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : gl Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.Method3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_Method3__int_ModuleInitializer { @@ -1302,11 +1352,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : gl TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Method4", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1335,42 +1381,20 @@ internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : gl ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method4", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Method4(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1393,6 +1417,37 @@ internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : gl Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.Method4(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_Method4__int_ModuleInitializer { @@ -1423,14 +1478,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSourc TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Exclusion", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.MatrixExclusionAttribute(1, 1), - new global::TUnit.Core.MatrixExclusionAttribute(2, 2), - new global::TUnit.Core.MatrixExclusionAttribute(3, 3), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1466,42 +1514,20 @@ internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSourc ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Exclusion", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.Exclusion(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1524,6 +1550,40 @@ internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSourc Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.MatrixExclusionAttribute(1, 1), + new global::TUnit.Core.MatrixExclusionAttribute(2, 2), + new global::TUnit.Core.MatrixExclusionAttribute(3, 3), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 2: + { + return new global::System.Threading.Tasks.ValueTask(instance.Exclusion(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_Exclusion__int_int_ModuleInitializer { @@ -1554,11 +1614,7 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParamet TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1594,42 +1650,20 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParamet ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool), typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1652,6 +1686,37 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParamet Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 2: + { + return new global::System.Threading.Tasks.ValueTask(instance.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__boo_38BEEE8F_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MatrixTest_WithConflictingNamespace.DotNet9_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MatrixTest_WithConflictingNamespace.DotNet9_0.verified.txt index 02f4777aa0..e7e4b8f9ea 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MatrixTest_WithConflictingNamespace.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MatrixTest_WithConflictingNamespace.DotNet9_0.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_b TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "MatrixTest_One", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -62,42 +58,20 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_b ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(int), typeof(bool) }, null)!.GetParameters()[2] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 3: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_One(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -120,6 +94,37 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_b Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 3: + { + return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_One(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_bool_ModuleInitializer { @@ -150,11 +155,7 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_ TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "MatrixTest_Two", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -204,42 +205,20 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_ ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int), typeof(int), typeof(bool) }, null)!.GetParameters()[3] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 4: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_Two(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 4 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -262,6 +241,37 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_ Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 4: + { + return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_Two(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 4 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_bool_ModuleInitializer { @@ -292,11 +302,7 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnu TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "MatrixTest_Enum", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -339,42 +345,20 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnu ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Enum", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(TestEnum), typeof(TestEnum?) }, null)!.GetParameters()[2] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 3: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_Enum(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -397,6 +381,37 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnu Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 3: + { + return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_Enum(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnum_TestEnum__ModuleInitializer { @@ -427,11 +442,7 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bo TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "AutoGenerateBools", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -467,42 +478,20 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bo ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("AutoGenerateBools", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(bool) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.AutoGenerateBools(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -525,6 +514,37 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bo Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 2: + { + return new global::System.Threading.Tasks.ValueTask(instance.AutoGenerateBools(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bool_ModuleInitializer { @@ -555,11 +575,7 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_b TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "AutoGenerateBools2", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -595,42 +611,20 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_b ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("AutoGenerateBools2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(bool?) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.AutoGenerateBools2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -653,6 +647,37 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_b Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 2: + { + return new global::System.Threading.Tasks.ValueTask(instance.AutoGenerateBools2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_bool__ModuleInitializer { @@ -683,11 +708,7 @@ internal sealed class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_Te TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "ImplicitConversion", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -723,42 +744,20 @@ internal sealed class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_Te ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("ImplicitConversion", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(OneOf), typeof(bool) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.ImplicitConversion(global::TUnit.Core.Helpers.CastHelper.Cast>(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -781,6 +780,37 @@ internal sealed class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_Te Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 2: + { + return new global::System.Threading.Tasks.ValueTask(instance.ImplicitConversion(global::TUnit.Core.Helpers.CastHelper.Cast>(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool_ModuleInitializer { @@ -811,11 +841,7 @@ internal sealed class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrix TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "ExcludingAutoGeneratedMatrixValues", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -851,42 +877,20 @@ internal sealed class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrix ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("ExcludingAutoGeneratedMatrixValues", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), typeof(bool) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.ExcludingAutoGeneratedMatrixValues(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -909,6 +913,37 @@ internal sealed class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrix Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 2: + { + return new global::System.Threading.Tasks.ValueTask(instance.ExcludingAutoGeneratedMatrixValues(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool_ModuleInitializer { @@ -939,11 +974,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method1__int_TestSource : gl TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Method1", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -972,42 +1003,20 @@ internal sealed class TUnit_TestProject_MatrixTests_Method1__int_TestSource : gl ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method1", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Method1(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1030,6 +1039,37 @@ internal sealed class TUnit_TestProject_MatrixTests_Method1__int_TestSource : gl Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.Method1(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_Method1__int_ModuleInitializer { @@ -1060,11 +1100,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method2__int_TestSource : gl TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Method2", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1093,42 +1129,20 @@ internal sealed class TUnit_TestProject_MatrixTests_Method2__int_TestSource : gl ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Method2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1151,6 +1165,37 @@ internal sealed class TUnit_TestProject_MatrixTests_Method2__int_TestSource : gl Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.Method2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_Method2__int_ModuleInitializer { @@ -1181,11 +1226,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : gl TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Method3", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1214,42 +1255,20 @@ internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : gl ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method3", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Method3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1272,6 +1291,37 @@ internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : gl Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.Method3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_Method3__int_ModuleInitializer { @@ -1302,11 +1352,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : gl TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Method4", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1335,42 +1381,20 @@ internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : gl ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method4", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Method4(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1393,6 +1417,37 @@ internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : gl Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.Method4(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_Method4__int_ModuleInitializer { @@ -1423,14 +1478,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSourc TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Exclusion", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.MatrixExclusionAttribute(1, 1), - new global::TUnit.Core.MatrixExclusionAttribute(2, 2), - new global::TUnit.Core.MatrixExclusionAttribute(3, 3), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1466,42 +1514,20 @@ internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSourc ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Exclusion", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.Exclusion(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1524,6 +1550,40 @@ internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSourc Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.MatrixExclusionAttribute(1, 1), + new global::TUnit.Core.MatrixExclusionAttribute(2, 2), + new global::TUnit.Core.MatrixExclusionAttribute(3, 3), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 2: + { + return new global::System.Threading.Tasks.ValueTask(instance.Exclusion(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_Exclusion__int_int_ModuleInitializer { @@ -1554,11 +1614,7 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParamet TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1594,42 +1650,20 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParamet ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool), typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1652,6 +1686,37 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParamet Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 2: + { + return new global::System.Threading.Tasks.ValueTask(instance.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__boo_38BEEE8F_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MethodDataSource_WithConflictingNamespace.DotNet10_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MethodDataSource_WithConflictingNamespace.DotNet10_0.verified.txt index 39f104fc47..7dca1eaf68 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MethodDataSource_WithConflictingNamespace.DotNet10_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MethodDataSource_WithConflictingNamespace.DotNet10_0.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -59,43 +55,20 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), - Name = "MethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "MethodDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -118,6 +91,38 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method__int_ModuleInitializer { @@ -148,11 +153,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method2", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -192,43 +193,20 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), - Name = "MethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "MethodDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -251,6 +229,38 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method2__int_ModuleInitializer { @@ -281,11 +291,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method_WithAction", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeAction") @@ -325,43 +331,20 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method_WithAction", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Action) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), - Name = "MethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "MethodDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method_WithAction(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -384,6 +367,38 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method_WithAction(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method_WithAction__Action_ModuleInitializer { @@ -414,11 +429,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method3", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -473,43 +484,20 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method3", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), - Name = "MethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "MethodDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -532,6 +520,38 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method3__int_ModuleInitializer { @@ -562,11 +582,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method4", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -648,43 +664,20 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method4", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), - Name = "MethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "MethodDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method4(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -707,6 +700,38 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method4(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method4__int_ModuleInitializer { @@ -737,11 +762,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_W TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_WithBaseReturn", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("MethodWithBaseReturn") @@ -781,43 +802,20 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_W ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_WithBaseReturn", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), - Name = "MethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "MethodDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_WithBaseReturn(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -840,6 +838,38 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_W Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_WithBaseReturn(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_WithBaseReturn__BaseValue_ModuleInitializer { @@ -870,11 +900,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "EnumerableFuncArrayTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("EnumerableFuncArrayTestData") @@ -924,42 +950,20 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("EnumerableFuncArrayTest", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string[]) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), - Name = "MethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "MethodDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.EnumerableFuncArrayTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -982,6 +986,37 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.EnumerableFuncArrayTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFuncArrayTest__string___ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MethodDataSource_WithConflictingNamespace.DotNet8_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MethodDataSource_WithConflictingNamespace.DotNet8_0.verified.txt index 39f104fc47..7dca1eaf68 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MethodDataSource_WithConflictingNamespace.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MethodDataSource_WithConflictingNamespace.DotNet8_0.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -59,43 +55,20 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), - Name = "MethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "MethodDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -118,6 +91,38 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method__int_ModuleInitializer { @@ -148,11 +153,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method2", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -192,43 +193,20 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), - Name = "MethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "MethodDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -251,6 +229,38 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method2__int_ModuleInitializer { @@ -281,11 +291,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method_WithAction", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeAction") @@ -325,43 +331,20 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method_WithAction", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Action) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), - Name = "MethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "MethodDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method_WithAction(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -384,6 +367,38 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method_WithAction(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method_WithAction__Action_ModuleInitializer { @@ -414,11 +429,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method3", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -473,43 +484,20 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method3", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), - Name = "MethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "MethodDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -532,6 +520,38 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method3__int_ModuleInitializer { @@ -562,11 +582,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method4", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -648,43 +664,20 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method4", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), - Name = "MethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "MethodDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method4(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -707,6 +700,38 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method4(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method4__int_ModuleInitializer { @@ -737,11 +762,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_W TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_WithBaseReturn", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("MethodWithBaseReturn") @@ -781,43 +802,20 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_W ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_WithBaseReturn", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), - Name = "MethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "MethodDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_WithBaseReturn(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -840,6 +838,38 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_W Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_WithBaseReturn(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_WithBaseReturn__BaseValue_ModuleInitializer { @@ -870,11 +900,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "EnumerableFuncArrayTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("EnumerableFuncArrayTestData") @@ -924,42 +950,20 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("EnumerableFuncArrayTest", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string[]) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), - Name = "MethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "MethodDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.EnumerableFuncArrayTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -982,6 +986,37 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.EnumerableFuncArrayTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFuncArrayTest__string___ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MethodDataSource_WithConflictingNamespace.DotNet9_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MethodDataSource_WithConflictingNamespace.DotNet9_0.verified.txt index 39f104fc47..7dca1eaf68 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MethodDataSource_WithConflictingNamespace.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MethodDataSource_WithConflictingNamespace.DotNet9_0.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -59,43 +55,20 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), - Name = "MethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "MethodDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -118,6 +91,38 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method__int_ModuleInitializer { @@ -148,11 +153,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method2", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -192,43 +193,20 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), - Name = "MethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "MethodDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -251,6 +229,38 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method2__int_ModuleInitializer { @@ -281,11 +291,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method_WithAction", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeAction") @@ -325,43 +331,20 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method_WithAction", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Action) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), - Name = "MethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "MethodDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method_WithAction(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -384,6 +367,38 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method_WithAction(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method_WithAction__Action_ModuleInitializer { @@ -414,11 +429,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method3", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -473,43 +484,20 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method3", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), - Name = "MethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "MethodDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -532,6 +520,38 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method3__int_ModuleInitializer { @@ -562,11 +582,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method4", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -648,43 +664,20 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method4", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), - Name = "MethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "MethodDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method4(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -707,6 +700,38 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method4(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method4__int_ModuleInitializer { @@ -737,11 +762,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_W TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_WithBaseReturn", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("MethodWithBaseReturn") @@ -781,43 +802,20 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_W ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_WithBaseReturn", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), - Name = "MethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "MethodDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_WithBaseReturn(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -840,6 +838,38 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_W Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_WithBaseReturn(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_WithBaseReturn__BaseValue_ModuleInitializer { @@ -870,11 +900,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "EnumerableFuncArrayTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("EnumerableFuncArrayTestData") @@ -924,42 +950,20 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("EnumerableFuncArrayTest", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string[]) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), - Name = "MethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "MethodDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.EnumerableFuncArrayTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -982,6 +986,37 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.EnumerableFuncArrayTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFuncArrayTest__string___ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.TupleDataSource_WithConflictingNamespace.DotNet10_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.TupleDataSource_WithConflictingNamespace.DotNet10_0.verified.txt index 80318b84bc..b922af14dc 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.TupleDataSource_WithConflictingNamespace.DotNet10_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.TupleDataSource_WithConflictingNamespace.DotNet10_0.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu TestClassType = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), TestMethodName = "DataSource_TupleMethod", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") @@ -73,43 +69,20 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu ReflectionInfo = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string), typeof(bool) }, null)!.GetParameters()[2] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TupleDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TupleDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests)), - Name = "TupleDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests)), + Name = "TupleDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.TupleDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 3: - { - instance.DataSource_TupleMethod(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -132,6 +105,38 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.TupleDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.TupleDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.TupleDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 3: + { + instance.DataSource_TupleMethod(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_TupleMethod__int_string_bool_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.TupleDataSource_WithConflictingNamespace.DotNet8_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.TupleDataSource_WithConflictingNamespace.DotNet8_0.verified.txt index 80318b84bc..b922af14dc 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.TupleDataSource_WithConflictingNamespace.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.TupleDataSource_WithConflictingNamespace.DotNet8_0.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu TestClassType = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), TestMethodName = "DataSource_TupleMethod", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") @@ -73,43 +69,20 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu ReflectionInfo = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string), typeof(bool) }, null)!.GetParameters()[2] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TupleDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TupleDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests)), - Name = "TupleDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests)), + Name = "TupleDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.TupleDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 3: - { - instance.DataSource_TupleMethod(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -132,6 +105,38 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.TupleDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.TupleDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.TupleDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 3: + { + instance.DataSource_TupleMethod(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_TupleMethod__int_string_bool_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.TupleDataSource_WithConflictingNamespace.DotNet9_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.TupleDataSource_WithConflictingNamespace.DotNet9_0.verified.txt index 80318b84bc..b922af14dc 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.TupleDataSource_WithConflictingNamespace.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.TupleDataSource_WithConflictingNamespace.DotNet9_0.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu TestClassType = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), TestMethodName = "DataSource_TupleMethod", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") @@ -73,43 +69,20 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu ReflectionInfo = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string), typeof(bool) }, null)!.GetParameters()[2] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TupleDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TupleDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests)), - Name = "TupleDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests)), + Name = "TupleDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.TupleDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 3: - { - instance.DataSource_TupleMethod(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -132,6 +105,38 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.TupleDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.TupleDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.TupleDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 3: + { + instance.DataSource_TupleMethod(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_TupleMethod__int_string_bool_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/ConstantArgumentsTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConstantArgumentsTests.Test.verified.txt index c31ef96e6c..acc8268ef8 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConstantArgumentsTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConstantArgumentsTests.Test.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_String1__string_T TestClassType = typeof(global::TUnit.TestProject.ConstantArgumentsTests), TestMethodName = "String1", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("123"), @@ -48,42 +44,20 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_String1__string_T ReflectionInfo = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("String1", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ConstantArgumentsTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ConstantArgumentsTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.ConstantArgumentsTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ConstantArgumentsTests)), - Name = "ConstantArgumentsTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.ConstantArgumentsTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ConstantArgumentsTests)), + Name = "ConstantArgumentsTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.ConstantArgumentsTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.String1(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -106,6 +80,37 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_String1__string_T Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.ConstantArgumentsTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.ConstantArgumentsTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ConstantArgumentsTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.String1(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_ConstantArgumentsTests_String1__string_ModuleInitializer { @@ -136,11 +141,7 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_Int__int_TestSour TestClassType = typeof(global::TUnit.TestProject.ConstantArgumentsTests), TestMethodName = "Int", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(123), @@ -169,42 +170,20 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_Int__int_TestSour ReflectionInfo = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("Int", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ConstantArgumentsTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ConstantArgumentsTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.ConstantArgumentsTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ConstantArgumentsTests)), - Name = "ConstantArgumentsTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.ConstantArgumentsTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ConstantArgumentsTests)), + Name = "ConstantArgumentsTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.ConstantArgumentsTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Int(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -227,6 +206,37 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_Int__int_TestSour Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.ConstantArgumentsTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.ConstantArgumentsTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ConstantArgumentsTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.Int(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_ConstantArgumentsTests_Int__int_ModuleInitializer { @@ -257,11 +267,7 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_Double__double_Te TestClassType = typeof(global::TUnit.TestProject.ConstantArgumentsTests), TestMethodName = "Double", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1.23d), @@ -290,42 +296,20 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_Double__double_Te ReflectionInfo = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("Double", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(double) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ConstantArgumentsTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ConstantArgumentsTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.ConstantArgumentsTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ConstantArgumentsTests)), - Name = "ConstantArgumentsTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.ConstantArgumentsTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ConstantArgumentsTests)), + Name = "ConstantArgumentsTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.ConstantArgumentsTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Double(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -348,6 +332,37 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_Double__double_Te Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.ConstantArgumentsTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.ConstantArgumentsTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ConstantArgumentsTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.Double(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_ConstantArgumentsTests_Double__double_ModuleInitializer { @@ -378,11 +393,7 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_Float__float_Test TestClassType = typeof(global::TUnit.TestProject.ConstantArgumentsTests), TestMethodName = "Float", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1.23000002f), @@ -411,42 +422,20 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_Float__float_Test ReflectionInfo = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("Float", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(float) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ConstantArgumentsTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ConstantArgumentsTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.ConstantArgumentsTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ConstantArgumentsTests)), - Name = "ConstantArgumentsTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.ConstantArgumentsTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ConstantArgumentsTests)), + Name = "ConstantArgumentsTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.ConstantArgumentsTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Float(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -469,6 +458,37 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_Float__float_Test Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.ConstantArgumentsTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.ConstantArgumentsTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ConstantArgumentsTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.Float(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_ConstantArgumentsTests_Float__float_ModuleInitializer { @@ -499,11 +519,7 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_Long__long_TestSo TestClassType = typeof(global::TUnit.TestProject.ConstantArgumentsTests), TestMethodName = "Long", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(123L), @@ -532,42 +548,20 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_Long__long_TestSo ReflectionInfo = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("Long", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(long) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ConstantArgumentsTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ConstantArgumentsTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.ConstantArgumentsTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ConstantArgumentsTests)), - Name = "ConstantArgumentsTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.ConstantArgumentsTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ConstantArgumentsTests)), + Name = "ConstantArgumentsTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.ConstantArgumentsTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Long(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -590,6 +584,37 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_Long__long_TestSo Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.ConstantArgumentsTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.ConstantArgumentsTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ConstantArgumentsTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.Long(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_ConstantArgumentsTests_Long__long_ModuleInitializer { @@ -620,11 +645,7 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_UInt__uint_TestSo TestClassType = typeof(global::TUnit.TestProject.ConstantArgumentsTests), TestMethodName = "UInt", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(123U), @@ -653,42 +674,20 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_UInt__uint_TestSo ReflectionInfo = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("UInt", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(uint) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ConstantArgumentsTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ConstantArgumentsTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.ConstantArgumentsTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ConstantArgumentsTests)), - Name = "ConstantArgumentsTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.ConstantArgumentsTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ConstantArgumentsTests)), + Name = "ConstantArgumentsTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.ConstantArgumentsTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.UInt(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -711,6 +710,37 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_UInt__uint_TestSo Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.ConstantArgumentsTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.ConstantArgumentsTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ConstantArgumentsTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.UInt(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_ConstantArgumentsTests_UInt__uint_ModuleInitializer { @@ -741,11 +771,7 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_ULong__ulong_Test TestClassType = typeof(global::TUnit.TestProject.ConstantArgumentsTests), TestMethodName = "ULong", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(123UL), @@ -774,42 +800,20 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_ULong__ulong_Test ReflectionInfo = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("ULong", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(ulong) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ConstantArgumentsTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ConstantArgumentsTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.ConstantArgumentsTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ConstantArgumentsTests)), - Name = "ConstantArgumentsTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.ConstantArgumentsTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ConstantArgumentsTests)), + Name = "ConstantArgumentsTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.ConstantArgumentsTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.ULong(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -832,6 +836,37 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_ULong__ulong_Test Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.ConstantArgumentsTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.ConstantArgumentsTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ConstantArgumentsTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.ULong(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_ConstantArgumentsTests_ULong__ulong_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/ConstantInBaseClassTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConstantInBaseClassTests.Test.verified.txt index 5433a00830..f43f14f1b9 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConstantInBaseClassTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConstantInBaseClassTests.Test.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_Bugs__1432_ConstantInBaseClassTests_Some TestClassType = typeof(global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests), TestMethodName = "SomeTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("Value"), @@ -48,42 +44,20 @@ internal sealed class TUnit_TestProject_Bugs__1432_ConstantInBaseClassTests_Some ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests).GetMethod("SomeTest", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests)), - Name = "ConstantInBaseClassTests", - Namespace = "TUnit.TestProject.Bugs._1432", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests)), + Name = "ConstantInBaseClassTests", + Namespace = "TUnit.TestProject.Bugs._1432", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.SomeTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -106,6 +80,37 @@ internal sealed class TUnit_TestProject_Bugs__1432_ConstantInBaseClassTests_Some Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.SomeTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__1432_ConstantInBaseClassTests_SomeTest__string_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/ConstantsInInterpolatedStringsTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConstantsInInterpolatedStringsTests.Test.verified.txt index cf2290fcc7..7a0f365e7e 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConstantsInInterpolatedStringsTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConstantsInInterpolatedStringsTests.Test.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_Bugs__1432_ConstantsInInterpolatedString TestClassType = typeof(global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests), TestMethodName = "SomeTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute($"{"Value"}1"), @@ -48,42 +44,20 @@ internal sealed class TUnit_TestProject_Bugs__1432_ConstantsInInterpolatedString ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests).GetMethod("SomeTest", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests)), - Name = "ConstantsInInterpolatedStringsTests", - Namespace = "TUnit.TestProject.Bugs._1432", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests)), + Name = "ConstantsInInterpolatedStringsTests", + Namespace = "TUnit.TestProject.Bugs._1432", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.SomeTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -106,6 +80,37 @@ internal sealed class TUnit_TestProject_Bugs__1432_ConstantsInInterpolatedString Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.SomeTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__1432_ConstantsInInterpolatedStringsTests_SomeTest__string_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/CustomDisplayNameTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/CustomDisplayNameTests.Test.verified.txt index 9b3955c677..4693907195 100644 --- a/TUnit.Core.SourceGenerator.Tests/CustomDisplayNameTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/CustomDisplayNameTests.Test.verified.txt @@ -15,12 +15,7 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_Test_TestSource : TestClassType = typeof(global::TUnit.TestProject.CustomDisplayNameTests), TestMethodName = "Test", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.DisplayNameAttribute("A super important test!"), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -37,52 +32,33 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_Test_TestSource : ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.CustomDisplayNameTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.CustomDisplayNameTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata + Type = typeof(global::TUnit.TestProject.CustomDisplayNameTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.CustomDisplayNameTests)), + Name = "CustomDisplayNameTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = new global::TUnit.Core.PropertyMetadata[] { - Type = typeof(global::TUnit.TestProject.CustomDisplayNameTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.CustomDisplayNameTests)), - Name = "CustomDisplayNameTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = new global::TUnit.Core.PropertyMetadata[] + new global::TUnit.Core.PropertyMetadata { - new global::TUnit.Core.PropertyMetadata - { - ReflectionInfo = typeof(global::TUnit.TestProject.CustomDisplayNameTests).GetProperty("Order"), - Type = typeof(int), - Name = "Order", - IsStatic = false, - IsNullable = false, - Getter = o => ((global::TUnit.TestProject.CustomDisplayNameTests)o).Order, - ClassMetadata = null!, - ContainingTypeMetadata = null! - } - }, - Parent = null - }; - foreach (var prop in classMetadata.Properties) - { - prop.ClassMetadata = classMetadata; - prop.ContainingTypeMetadata = classMetadata; - } - return classMetadata; + ReflectionInfo = typeof(global::TUnit.TestProject.CustomDisplayNameTests).GetProperty("Order"), + Type = typeof(int), + Name = "Order", + IsStatic = false, + IsNullable = false, + Getter = o => ((global::TUnit.TestProject.CustomDisplayNameTests)o).Order, + ClassMetadata = null!, + ContainingTypeMetadata = null! + } + }, + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.CustomDisplayNameTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.Test()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -105,6 +81,30 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_Test_TestSource : Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.DisplayNameAttribute("A super important test!"), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.CustomDisplayNameTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.CustomDisplayNameTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.CustomDisplayNameTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.Test()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_CustomDisplayNameTests_Test_ModuleInitializer { @@ -135,12 +135,7 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_Test2_TestSource TestClassType = typeof(global::TUnit.TestProject.CustomDisplayNameTests), TestMethodName = "Test2", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.DisplayNameAttribute("Another super important test!"), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -157,52 +152,33 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_Test2_TestSource ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.CustomDisplayNameTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.CustomDisplayNameTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata + Type = typeof(global::TUnit.TestProject.CustomDisplayNameTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.CustomDisplayNameTests)), + Name = "CustomDisplayNameTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = new global::TUnit.Core.PropertyMetadata[] { - Type = typeof(global::TUnit.TestProject.CustomDisplayNameTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.CustomDisplayNameTests)), - Name = "CustomDisplayNameTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = new global::TUnit.Core.PropertyMetadata[] + new global::TUnit.Core.PropertyMetadata { - new global::TUnit.Core.PropertyMetadata - { - ReflectionInfo = typeof(global::TUnit.TestProject.CustomDisplayNameTests).GetProperty("Order"), - Type = typeof(int), - Name = "Order", - IsStatic = false, - IsNullable = false, - Getter = o => ((global::TUnit.TestProject.CustomDisplayNameTests)o).Order, - ClassMetadata = null!, - ContainingTypeMetadata = null! - } - }, - Parent = null - }; - foreach (var prop in classMetadata.Properties) - { - prop.ClassMetadata = classMetadata; - prop.ContainingTypeMetadata = classMetadata; - } - return classMetadata; + ReflectionInfo = typeof(global::TUnit.TestProject.CustomDisplayNameTests).GetProperty("Order"), + Type = typeof(int), + Name = "Order", + IsStatic = false, + IsNullable = false, + Getter = o => ((global::TUnit.TestProject.CustomDisplayNameTests)o).Order, + ClassMetadata = null!, + ContainingTypeMetadata = null! + } + }, + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.CustomDisplayNameTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.Test2()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -225,6 +201,30 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_Test2_TestSource Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.DisplayNameAttribute("Another super important test!"), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.CustomDisplayNameTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.CustomDisplayNameTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.CustomDisplayNameTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.Test2()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_CustomDisplayNameTests_Test2_ModuleInitializer { @@ -255,12 +255,7 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_Test3__string_int TestClassType = typeof(global::TUnit.TestProject.CustomDisplayNameTests), TestMethodName = "Test3", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.DisplayNameAttribute("Test with: $value1 $value2 $value3!"), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("foo", 1, true), @@ -304,60 +299,33 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_Test3__string_int ReflectionInfo = typeof(global::TUnit.TestProject.CustomDisplayNameTests).GetMethod("Test3", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(int), typeof(bool) }, null)!.GetParameters()[2] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.CustomDisplayNameTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.CustomDisplayNameTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata + Type = typeof(global::TUnit.TestProject.CustomDisplayNameTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.CustomDisplayNameTests)), + Name = "CustomDisplayNameTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = new global::TUnit.Core.PropertyMetadata[] { - Type = typeof(global::TUnit.TestProject.CustomDisplayNameTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.CustomDisplayNameTests)), - Name = "CustomDisplayNameTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = new global::TUnit.Core.PropertyMetadata[] + new global::TUnit.Core.PropertyMetadata { - new global::TUnit.Core.PropertyMetadata - { - ReflectionInfo = typeof(global::TUnit.TestProject.CustomDisplayNameTests).GetProperty("Order"), - Type = typeof(int), - Name = "Order", - IsStatic = false, - IsNullable = false, - Getter = o => ((global::TUnit.TestProject.CustomDisplayNameTests)o).Order, - ClassMetadata = null!, - ContainingTypeMetadata = null! - } - }, - Parent = null - }; - foreach (var prop in classMetadata.Properties) - { - prop.ClassMetadata = classMetadata; - prop.ContainingTypeMetadata = classMetadata; - } - return classMetadata; + ReflectionInfo = typeof(global::TUnit.TestProject.CustomDisplayNameTests).GetProperty("Order"), + Type = typeof(int), + Name = "Order", + IsStatic = false, + IsNullable = false, + Getter = o => ((global::TUnit.TestProject.CustomDisplayNameTests)o).Order, + ClassMetadata = null!, + ContainingTypeMetadata = null! + } + }, + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.CustomDisplayNameTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 3: - { - return new global::System.Threading.Tasks.ValueTask(instance.Test3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -380,6 +348,38 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_Test3__string_int Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.DisplayNameAttribute("Test with: $value1 $value2 $value3!"), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.CustomDisplayNameTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.CustomDisplayNameTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.CustomDisplayNameTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 3: + { + return new global::System.Threading.Tasks.ValueTask(instance.Test3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_CustomDisplayNameTests_Test3__string_int_bool_ModuleInitializer { @@ -410,12 +410,7 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_MethodDataSourceT TestClassType = typeof(global::TUnit.TestProject.CustomDisplayNameTests), TestMethodName = "MethodDataSourceTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.DisplayNameAttribute("Test using MethodDataSource"), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("Method") @@ -455,60 +450,33 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_MethodDataSourceT ReflectionInfo = typeof(global::TUnit.TestProject.CustomDisplayNameTests).GetMethod("MethodDataSourceTest", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.CustomDisplayNameTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.CustomDisplayNameTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata + Type = typeof(global::TUnit.TestProject.CustomDisplayNameTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.CustomDisplayNameTests)), + Name = "CustomDisplayNameTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = new global::TUnit.Core.PropertyMetadata[] { - Type = typeof(global::TUnit.TestProject.CustomDisplayNameTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.CustomDisplayNameTests)), - Name = "CustomDisplayNameTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = new global::TUnit.Core.PropertyMetadata[] + new global::TUnit.Core.PropertyMetadata { - new global::TUnit.Core.PropertyMetadata - { - ReflectionInfo = typeof(global::TUnit.TestProject.CustomDisplayNameTests).GetProperty("Order"), - Type = typeof(int), - Name = "Order", - IsStatic = false, - IsNullable = false, - Getter = o => ((global::TUnit.TestProject.CustomDisplayNameTests)o).Order, - ClassMetadata = null!, - ContainingTypeMetadata = null! - } - }, - Parent = null - }; - foreach (var prop in classMetadata.Properties) - { - prop.ClassMetadata = classMetadata; - prop.ContainingTypeMetadata = classMetadata; - } - return classMetadata; + ReflectionInfo = typeof(global::TUnit.TestProject.CustomDisplayNameTests).GetProperty("Order"), + Type = typeof(int), + Name = "Order", + IsStatic = false, + IsNullable = false, + Getter = o => ((global::TUnit.TestProject.CustomDisplayNameTests)o).Order, + ClassMetadata = null!, + ContainingTypeMetadata = null! + } + }, + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.CustomDisplayNameTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.MethodDataSourceTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -531,6 +499,38 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_MethodDataSourceT Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.DisplayNameAttribute("Test using MethodDataSource"), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.CustomDisplayNameTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.CustomDisplayNameTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.CustomDisplayNameTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.MethodDataSourceTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_CustomDisplayNameTests_MethodDataSourceTest__string_ModuleInitializer { @@ -561,12 +561,7 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_TestParameterName TestClassType = typeof(global::TUnit.TestProject.CustomDisplayNameTests), TestMethodName = "TestParameterNamePrefixBug", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.DisplayNameAttribute("Test this($someValue, $someValueType)"), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(100, "Type1"), @@ -604,60 +599,33 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_TestParameterName ReflectionInfo = typeof(global::TUnit.TestProject.CustomDisplayNameTests).GetMethod("TestParameterNamePrefixBug", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.CustomDisplayNameTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.CustomDisplayNameTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata + Type = typeof(global::TUnit.TestProject.CustomDisplayNameTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.CustomDisplayNameTests)), + Name = "CustomDisplayNameTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = new global::TUnit.Core.PropertyMetadata[] { - Type = typeof(global::TUnit.TestProject.CustomDisplayNameTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.CustomDisplayNameTests)), - Name = "CustomDisplayNameTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = new global::TUnit.Core.PropertyMetadata[] + new global::TUnit.Core.PropertyMetadata { - new global::TUnit.Core.PropertyMetadata - { - ReflectionInfo = typeof(global::TUnit.TestProject.CustomDisplayNameTests).GetProperty("Order"), - Type = typeof(int), - Name = "Order", - IsStatic = false, - IsNullable = false, - Getter = o => ((global::TUnit.TestProject.CustomDisplayNameTests)o).Order, - ClassMetadata = null!, - ContainingTypeMetadata = null! - } - }, - Parent = null - }; - foreach (var prop in classMetadata.Properties) - { - prop.ClassMetadata = classMetadata; - prop.ContainingTypeMetadata = classMetadata; - } - return classMetadata; + ReflectionInfo = typeof(global::TUnit.TestProject.CustomDisplayNameTests).GetProperty("Order"), + Type = typeof(int), + Name = "Order", + IsStatic = false, + IsNullable = false, + Getter = o => ((global::TUnit.TestProject.CustomDisplayNameTests)o).Order, + ClassMetadata = null!, + ContainingTypeMetadata = null! + } + }, + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.CustomDisplayNameTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.TestParameterNamePrefixBug(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -680,6 +648,38 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_TestParameterName Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.DisplayNameAttribute("Test this($someValue, $someValueType)"), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.CustomDisplayNameTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.CustomDisplayNameTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.CustomDisplayNameTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 2: + { + return new global::System.Threading.Tasks.ValueTask(instance.TestParameterNamePrefixBug(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_CustomDisplayNameTests_TestParameterNamePrefixBug__int_string_ModuleInitializer { @@ -710,11 +710,7 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_PasswordTest__str TestClassType = typeof(global::TUnit.TestProject.CustomDisplayNameTests), TestMethodName = "PasswordTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.TestProject.CustomDisplayNameTests.MyGenerator(), @@ -743,60 +739,33 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_PasswordTest__str ReflectionInfo = typeof(global::TUnit.TestProject.CustomDisplayNameTests).GetMethod("PasswordTest", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.CustomDisplayNameTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.CustomDisplayNameTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata + Type = typeof(global::TUnit.TestProject.CustomDisplayNameTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.CustomDisplayNameTests)), + Name = "CustomDisplayNameTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = new global::TUnit.Core.PropertyMetadata[] { - Type = typeof(global::TUnit.TestProject.CustomDisplayNameTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.CustomDisplayNameTests)), - Name = "CustomDisplayNameTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = new global::TUnit.Core.PropertyMetadata[] + new global::TUnit.Core.PropertyMetadata { - new global::TUnit.Core.PropertyMetadata - { - ReflectionInfo = typeof(global::TUnit.TestProject.CustomDisplayNameTests).GetProperty("Order"), - Type = typeof(int), - Name = "Order", - IsStatic = false, - IsNullable = false, - Getter = o => ((global::TUnit.TestProject.CustomDisplayNameTests)o).Order, - ClassMetadata = null!, - ContainingTypeMetadata = null! - } - }, - Parent = null - }; - foreach (var prop in classMetadata.Properties) - { - prop.ClassMetadata = classMetadata; - prop.ContainingTypeMetadata = classMetadata; - } - return classMetadata; + ReflectionInfo = typeof(global::TUnit.TestProject.CustomDisplayNameTests).GetProperty("Order"), + Type = typeof(int), + Name = "Order", + IsStatic = false, + IsNullable = false, + Getter = o => ((global::TUnit.TestProject.CustomDisplayNameTests)o).Order, + ClassMetadata = null!, + ContainingTypeMetadata = null! + } + }, + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.CustomDisplayNameTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.PasswordTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -819,6 +788,37 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_PasswordTest__str Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.CustomDisplayNameTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.CustomDisplayNameTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.CustomDisplayNameTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.PasswordTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_CustomDisplayNameTests_PasswordTest__string_ModuleInitializer { @@ -849,12 +849,7 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_SameClassConstant TestClassType = typeof(global::TUnit.TestProject.CustomDisplayNameTests), TestMethodName = "SameClassConstantTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.DisplayNameAttribute($"My test {"My constant"}"), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -871,52 +866,33 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_SameClassConstant ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.CustomDisplayNameTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.CustomDisplayNameTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata + Type = typeof(global::TUnit.TestProject.CustomDisplayNameTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.CustomDisplayNameTests)), + Name = "CustomDisplayNameTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = new global::TUnit.Core.PropertyMetadata[] { - Type = typeof(global::TUnit.TestProject.CustomDisplayNameTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.CustomDisplayNameTests)), - Name = "CustomDisplayNameTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = new global::TUnit.Core.PropertyMetadata[] + new global::TUnit.Core.PropertyMetadata { - new global::TUnit.Core.PropertyMetadata - { - ReflectionInfo = typeof(global::TUnit.TestProject.CustomDisplayNameTests).GetProperty("Order"), - Type = typeof(int), - Name = "Order", - IsStatic = false, - IsNullable = false, - Getter = o => ((global::TUnit.TestProject.CustomDisplayNameTests)o).Order, - ClassMetadata = null!, - ContainingTypeMetadata = null! - } - }, - Parent = null - }; - foreach (var prop in classMetadata.Properties) - { - prop.ClassMetadata = classMetadata; - prop.ContainingTypeMetadata = classMetadata; - } - return classMetadata; + ReflectionInfo = typeof(global::TUnit.TestProject.CustomDisplayNameTests).GetProperty("Order"), + Type = typeof(int), + Name = "Order", + IsStatic = false, + IsNullable = false, + Getter = o => ((global::TUnit.TestProject.CustomDisplayNameTests)o).Order, + ClassMetadata = null!, + ContainingTypeMetadata = null! + } + }, + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.CustomDisplayNameTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.SameClassConstantTest()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -939,6 +915,30 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_SameClassConstant Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.DisplayNameAttribute($"My test {"My constant"}"), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.CustomDisplayNameTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.CustomDisplayNameTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.CustomDisplayNameTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.SameClassConstantTest()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_CustomDisplayNameTests_SameClassConstantTest_ModuleInitializer { @@ -969,12 +969,7 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_DifferentClassCon TestClassType = typeof(global::TUnit.TestProject.CustomDisplayNameTests), TestMethodName = "DifferentClassConstantTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.DisplayNameAttribute($"My test {"My constant"}"), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -991,52 +986,33 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_DifferentClassCon ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.CustomDisplayNameTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.CustomDisplayNameTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata + Type = typeof(global::TUnit.TestProject.CustomDisplayNameTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.CustomDisplayNameTests)), + Name = "CustomDisplayNameTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = new global::TUnit.Core.PropertyMetadata[] { - Type = typeof(global::TUnit.TestProject.CustomDisplayNameTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.CustomDisplayNameTests)), - Name = "CustomDisplayNameTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = new global::TUnit.Core.PropertyMetadata[] + new global::TUnit.Core.PropertyMetadata { - new global::TUnit.Core.PropertyMetadata - { - ReflectionInfo = typeof(global::TUnit.TestProject.CustomDisplayNameTests).GetProperty("Order"), - Type = typeof(int), - Name = "Order", - IsStatic = false, - IsNullable = false, - Getter = o => ((global::TUnit.TestProject.CustomDisplayNameTests)o).Order, - ClassMetadata = null!, - ContainingTypeMetadata = null! - } - }, - Parent = null - }; - foreach (var prop in classMetadata.Properties) - { - prop.ClassMetadata = classMetadata; - prop.ContainingTypeMetadata = classMetadata; - } - return classMetadata; + ReflectionInfo = typeof(global::TUnit.TestProject.CustomDisplayNameTests).GetProperty("Order"), + Type = typeof(int), + Name = "Order", + IsStatic = false, + IsNullable = false, + Getter = o => ((global::TUnit.TestProject.CustomDisplayNameTests)o).Order, + ClassMetadata = null!, + ContainingTypeMetadata = null! + } + }, + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.CustomDisplayNameTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.DifferentClassConstantTest()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1059,6 +1035,30 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_DifferentClassCon Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.DisplayNameAttribute($"My test {"My constant"}"), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.CustomDisplayNameTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.CustomDisplayNameTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.CustomDisplayNameTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.DifferentClassConstantTest()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_CustomDisplayNameTests_DifferentClassConstantTest_ModuleInitializer { @@ -1089,12 +1089,7 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_NestedClassConsta TestClassType = typeof(global::TUnit.TestProject.CustomDisplayNameTests), TestMethodName = "NestedClassConstantTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.DisplayNameAttribute($"My test {"My constant"}"), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -1111,52 +1106,33 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_NestedClassConsta ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.CustomDisplayNameTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.CustomDisplayNameTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata + Type = typeof(global::TUnit.TestProject.CustomDisplayNameTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.CustomDisplayNameTests)), + Name = "CustomDisplayNameTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = new global::TUnit.Core.PropertyMetadata[] { - Type = typeof(global::TUnit.TestProject.CustomDisplayNameTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.CustomDisplayNameTests)), - Name = "CustomDisplayNameTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = new global::TUnit.Core.PropertyMetadata[] + new global::TUnit.Core.PropertyMetadata { - new global::TUnit.Core.PropertyMetadata - { - ReflectionInfo = typeof(global::TUnit.TestProject.CustomDisplayNameTests).GetProperty("Order"), - Type = typeof(int), - Name = "Order", - IsStatic = false, - IsNullable = false, - Getter = o => ((global::TUnit.TestProject.CustomDisplayNameTests)o).Order, - ClassMetadata = null!, - ContainingTypeMetadata = null! - } - }, - Parent = null - }; - foreach (var prop in classMetadata.Properties) - { - prop.ClassMetadata = classMetadata; - prop.ContainingTypeMetadata = classMetadata; - } - return classMetadata; + ReflectionInfo = typeof(global::TUnit.TestProject.CustomDisplayNameTests).GetProperty("Order"), + Type = typeof(int), + Name = "Order", + IsStatic = false, + IsNullable = false, + Getter = o => ((global::TUnit.TestProject.CustomDisplayNameTests)o).Order, + ClassMetadata = null!, + ContainingTypeMetadata = null! + } + }, + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.CustomDisplayNameTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.NestedClassConstantTest()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1179,6 +1155,30 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_NestedClassConsta Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.DisplayNameAttribute($"My test {"My constant"}"), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.CustomDisplayNameTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.CustomDisplayNameTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.CustomDisplayNameTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.NestedClassConstantTest()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_CustomDisplayNameTests_NestedClassConstantTest_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/DataDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/DataDrivenTests.Test.verified.txt index 1f79ca1e5f..51e0a0b0a8 100644 --- a/TUnit.Core.SourceGenerator.Tests/DataDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DataDrivenTests.Test.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_T TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "DataSource_Method", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1), @@ -50,43 +46,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_T ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -109,6 +82,38 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_T Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_ModuleInitializer { @@ -139,11 +144,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_s TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "DataSource_Method", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1, "String"), @@ -181,43 +182,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_s ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 2: - { - instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -240,6 +218,38 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_s Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 2: + { + instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_string_ModuleInitializer { @@ -270,11 +280,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_Test TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "EnumValue", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.One), @@ -305,43 +311,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_Test ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("EnumValue", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.TestEnum) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.EnumValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -364,6 +347,38 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_Test Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.EnumValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_ModuleInitializer { @@ -394,11 +409,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NullValue__string__TestS TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "NullValue", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(null), @@ -427,43 +438,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NullValue__string__TestS ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("NullValue", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.NullValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -486,6 +474,38 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NullValue__string__TestS Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.NullValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataDrivenTests_NullValue__string__ModuleInitializer { @@ -516,11 +536,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EmptyString__string__Tes TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "EmptyString", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(""), @@ -549,43 +565,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EmptyString__string__Tes ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("EmptyString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.EmptyString(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -608,6 +601,38 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EmptyString__string__Tes Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.EmptyString(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataDrivenTests_EmptyString__string__ModuleInitializer { @@ -638,11 +663,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "NonEmptyString", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("Foo bar!"), @@ -671,43 +692,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("NonEmptyString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.NonEmptyString(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -730,6 +728,38 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.NonEmptyString(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ModuleInitializer { @@ -760,11 +790,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__Tes TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "BooleanString", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(null), @@ -795,43 +821,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__Tes ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("BooleanString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool?) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.BooleanString(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -854,6 +857,38 @@ internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__Tes Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.BooleanString(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataDrivenTests_BooleanString__bool__ModuleInitializer { @@ -884,11 +919,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "Type", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(typeof(object)), @@ -917,43 +948,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("Type", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Type) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.Type(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -976,6 +984,38 @@ internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.Type(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataDrivenTests_Type__Type_ModuleInitializer { @@ -1006,11 +1046,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___Test TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "IntegerArray", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(new[] { 1, 2, 3 }), @@ -1039,43 +1075,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___Test ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("IntegerArray", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int[]) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.IntegerArray(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1098,6 +1111,38 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___Test Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.IntegerArray(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataDrivenTests_IntegerArray__int___ModuleInitializer { @@ -1128,11 +1173,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSou TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "IntMaxValue", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(2147483647), @@ -1161,43 +1202,20 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSou ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("IntMaxValue", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DataDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "DataDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DataDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.IntMaxValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1220,6 +1238,38 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSou Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.IntMaxValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/DataSourceClassCombinedWithDataSourceMethodTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/DataSourceClassCombinedWithDataSourceMethodTests.Test.verified.txt index 0286bae7f4..3d9411b9bf 100644 --- a/TUnit.Core.SourceGenerator.Tests/DataSourceClassCombinedWithDataSourceMethodTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DataSourceClassCombinedWithDataSourceMethodTests.Test.verified.txt @@ -15,14 +15,7 @@ internal sealed class TUnit_TestProject_DataSourceClassCombinedWithDataSourceMet TestClassType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), TestMethodName = "DataSourceClassCombinedWithDataSourceMethodTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "One"), - new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Two"), - new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Three") - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "One") @@ -124,55 +117,29 @@ internal sealed class TUnit_TestProject_DataSourceClassCombinedWithDataSourceMet ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetMethod("DataSourceClassCombinedWithDataSourceMethodTest", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata + Type = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod)), + Name = "DataSourceClassCombinedWithDataSourceMethod", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = new global::TUnit.Core.ParameterMetadata[] { - Type = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod)), - Name = "DataSourceClassCombinedWithDataSourceMethod", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = new global::TUnit.Core.ParameterMetadata[] + new global::TUnit.Core.ParameterMetadata(typeof(int)) { - new global::TUnit.Core.ParameterMetadata(typeof(int)) - { - Name = "i", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0] - } - }, - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Name = "i", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSourceClassCombinedWithDataSourceMethodTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -195,6 +162,41 @@ internal sealed class TUnit_TestProject_DataSourceClassCombinedWithDataSourceMet Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "One"), + new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Two"), + new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Three") + ]; + } + private static global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSourceClassCombinedWithDataSourceMethodTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataSourceClassCombinedWithDataSourceMethod_DataSourceClassCombinedW_3C180E22_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Typed.verified.txt b/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Typed.verified.txt index c710ef094c..0a26a9a4c1 100644 --- a/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Typed.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Typed.verified.txt @@ -15,13 +15,7 @@ internal sealed class TUnit_TestProject_DataSourceGeneratorTests_GeneratedData_M TestClassType = typeof(global::TUnit.TestProject.DataSourceGeneratorTests), TestMethodName = "GeneratedData_Method", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), - new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), @@ -54,69 +48,43 @@ internal sealed class TUnit_TestProject_DataSourceGeneratorTests_GeneratedData_M ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetMethod("GeneratedData_Method", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataSourceGeneratorTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataSourceGeneratorTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata + Type = typeof(global::TUnit.TestProject.DataSourceGeneratorTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataSourceGeneratorTests)), + Name = "DataSourceGeneratorTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = new global::TUnit.Core.ParameterMetadata[] { - Type = typeof(global::TUnit.TestProject.DataSourceGeneratorTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataSourceGeneratorTests)), - Name = "DataSourceGeneratorTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = new global::TUnit.Core.ParameterMetadata[] + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) { - new global::TUnit.Core.ParameterMetadata(typeof(int)) - { - Name = "value", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[0] - }, - new global::TUnit.Core.ParameterMetadata(typeof(string)) - { - Name = "value2", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[1] - }, - new global::TUnit.Core.ParameterMetadata(typeof(bool)) - { - Name = "value3", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[2] - } + Name = "value2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[1] }, - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "value3", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[2] + } + }, + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.DataSourceGeneratorTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2])); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.GeneratedData_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -139,6 +107,40 @@ internal sealed class TUnit_TestProject_DataSourceGeneratorTests_GeneratedData_M Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), + new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute() + ]; + } + private static global::TUnit.TestProject.DataSourceGeneratorTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataSourceGeneratorTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2])); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataSourceGeneratorTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.GeneratedData_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataSourceGeneratorTests_GeneratedData_Method__int_ModuleInitializer { @@ -169,13 +171,7 @@ internal sealed class TUnit_TestProject_DataSourceGeneratorTests_GeneratedData_M TestClassType = typeof(global::TUnit.TestProject.DataSourceGeneratorTests), TestMethodName = "GeneratedData_Method2", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), - new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), @@ -222,69 +218,43 @@ internal sealed class TUnit_TestProject_DataSourceGeneratorTests_GeneratedData_M ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetMethod("GeneratedData_Method2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string), typeof(bool) }, null)!.GetParameters()[2] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataSourceGeneratorTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataSourceGeneratorTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata + Type = typeof(global::TUnit.TestProject.DataSourceGeneratorTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataSourceGeneratorTests)), + Name = "DataSourceGeneratorTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = new global::TUnit.Core.ParameterMetadata[] { - Type = typeof(global::TUnit.TestProject.DataSourceGeneratorTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataSourceGeneratorTests)), - Name = "DataSourceGeneratorTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = new global::TUnit.Core.ParameterMetadata[] + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) { - new global::TUnit.Core.ParameterMetadata(typeof(int)) - { - Name = "value", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[0] - }, - new global::TUnit.Core.ParameterMetadata(typeof(string)) - { - Name = "value2", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[1] - }, - new global::TUnit.Core.ParameterMetadata(typeof(bool)) - { - Name = "value3", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[2] - } + Name = "value2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[1] }, - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "value3", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[2] + } + }, + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.DataSourceGeneratorTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2])); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 3: - { - instance.GeneratedData_Method2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -307,6 +277,40 @@ internal sealed class TUnit_TestProject_DataSourceGeneratorTests_GeneratedData_M Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), + new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute() + ]; + } + private static global::TUnit.TestProject.DataSourceGeneratorTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataSourceGeneratorTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2])); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataSourceGeneratorTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 3: + { + instance.GeneratedData_Method2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataSourceGeneratorTests_GeneratedData_Method2__int_string_bool_ModuleInitializer { @@ -337,13 +341,7 @@ internal sealed class TUnit_TestProject_DataSourceGeneratorTests_GeneratedData_M TestClassType = typeof(global::TUnit.TestProject.DataSourceGeneratorTests), TestMethodName = "GeneratedData_Method3", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), - new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), @@ -390,69 +388,43 @@ internal sealed class TUnit_TestProject_DataSourceGeneratorTests_GeneratedData_M ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetMethod("GeneratedData_Method3", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string), typeof(bool) }, null)!.GetParameters()[2] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataSourceGeneratorTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataSourceGeneratorTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata + Type = typeof(global::TUnit.TestProject.DataSourceGeneratorTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataSourceGeneratorTests)), + Name = "DataSourceGeneratorTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = new global::TUnit.Core.ParameterMetadata[] { - Type = typeof(global::TUnit.TestProject.DataSourceGeneratorTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataSourceGeneratorTests)), - Name = "DataSourceGeneratorTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = new global::TUnit.Core.ParameterMetadata[] + new global::TUnit.Core.ParameterMetadata(typeof(int)) { - new global::TUnit.Core.ParameterMetadata(typeof(int)) - { - Name = "value", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[0] - }, - new global::TUnit.Core.ParameterMetadata(typeof(string)) - { - Name = "value2", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[1] - }, - new global::TUnit.Core.ParameterMetadata(typeof(bool)) - { - Name = "value3", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[2] - } + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[0] }, - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "value2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[1] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "value3", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[2] + } + }, + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.DataSourceGeneratorTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2])); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 3: - { - instance.GeneratedData_Method3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -475,6 +447,40 @@ internal sealed class TUnit_TestProject_DataSourceGeneratorTests_GeneratedData_M Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), + new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute() + ]; + } + private static global::TUnit.TestProject.DataSourceGeneratorTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DataSourceGeneratorTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2])); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataSourceGeneratorTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 3: + { + instance.GeneratedData_Method3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DataSourceGeneratorTests_GeneratedData_Method3__int_string_bool_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Untyped.verified.txt b/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Untyped.verified.txt index c42eb2e30e..af8d2dde34 100644 --- a/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Untyped.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Untyped.verified.txt @@ -15,10 +15,7 @@ internal sealed class TUnit_TestProject_AutoDataTests_Test1__string_int_double_b TestClassType = typeof(global::TUnit.TestProject.AutoDataTests), TestMethodName = "Test1", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.TestProject.Attributes.AutoDataAttribute(), @@ -68,42 +65,20 @@ internal sealed class TUnit_TestProject_AutoDataTests_Test1__string_int_double_b ReflectionInfo = typeof(global::TUnit.TestProject.AutoDataTests).GetMethod("Test1", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(int), typeof(double), typeof(bool) }, null)!.GetParameters()[3] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AutoDataTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AutoDataTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AutoDataTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AutoDataTests)), - Name = "AutoDataTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AutoDataTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AutoDataTests)), + Name = "AutoDataTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.AutoDataTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 4: - { - return new global::System.Threading.Tasks.ValueTask(instance.Test1(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 4 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -126,6 +101,36 @@ internal sealed class TUnit_TestProject_AutoDataTests_Test1__string_int_double_b Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.AutoDataTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.AutoDataTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AutoDataTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 4: + { + return new global::System.Threading.Tasks.ValueTask(instance.Test1(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 4 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_AutoDataTests_Test1__string_int_double_bool_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/DecimalArgumentTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/DecimalArgumentTests.Test.verified.txt index d64fec6f0b..c514c5cef7 100644 --- a/TUnit.Core.SourceGenerator.Tests/DecimalArgumentTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DecimalArgumentTests.Test.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_Transfer__decimal_d TestClassType = typeof(global::TUnit.TestProject.DecimalArgumentTests), TestMethodName = "Transfer", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(2_000m, 123_999.00000000000000001m), @@ -57,42 +53,20 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_Transfer__decimal_d ReflectionInfo = typeof(global::TUnit.TestProject.DecimalArgumentTests).GetMethod("Transfer", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(decimal), typeof(decimal) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DecimalArgumentTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DecimalArgumentTests)), - Name = "DecimalArgumentTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DecimalArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DecimalArgumentTests)), + Name = "DecimalArgumentTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DecimalArgumentTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.Transfer(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -115,6 +89,37 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_Transfer__decimal_d Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DecimalArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DecimalArgumentTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DecimalArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 2: + { + return new global::System.Threading.Tasks.ValueTask(instance.Transfer(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DecimalArgumentTests_Transfer__decimal_decimal_ModuleInitializer { @@ -145,11 +150,7 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_SimpleDecimal__deci TestClassType = typeof(global::TUnit.TestProject.DecimalArgumentTests), TestMethodName = "SimpleDecimal", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(123.456m), @@ -178,42 +179,20 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_SimpleDecimal__deci ReflectionInfo = typeof(global::TUnit.TestProject.DecimalArgumentTests).GetMethod("SimpleDecimal", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(decimal) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DecimalArgumentTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DecimalArgumentTests)), - Name = "DecimalArgumentTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DecimalArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DecimalArgumentTests)), + Name = "DecimalArgumentTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DecimalArgumentTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.SimpleDecimal(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -236,6 +215,37 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_SimpleDecimal__deci Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DecimalArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DecimalArgumentTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DecimalArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.SimpleDecimal(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DecimalArgumentTests_SimpleDecimal__decimal_ModuleInitializer { @@ -266,11 +276,7 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_SmallDecimal__decim TestClassType = typeof(global::TUnit.TestProject.DecimalArgumentTests), TestMethodName = "SmallDecimal", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(0.00000000000000001m), @@ -299,42 +305,20 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_SmallDecimal__decim ReflectionInfo = typeof(global::TUnit.TestProject.DecimalArgumentTests).GetMethod("SmallDecimal", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(decimal) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DecimalArgumentTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DecimalArgumentTests)), - Name = "DecimalArgumentTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DecimalArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DecimalArgumentTests)), + Name = "DecimalArgumentTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DecimalArgumentTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.SmallDecimal(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -357,6 +341,37 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_SmallDecimal__decim Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DecimalArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DecimalArgumentTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DecimalArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.SmallDecimal(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DecimalArgumentTests_SmallDecimal__decimal_ModuleInitializer { @@ -387,11 +402,7 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_MaxDecimal__decimal TestClassType = typeof(global::TUnit.TestProject.DecimalArgumentTests), TestMethodName = "MaxDecimal", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("79228162514264337593543950335"), @@ -420,42 +431,20 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_MaxDecimal__decimal ReflectionInfo = typeof(global::TUnit.TestProject.DecimalArgumentTests).GetMethod("MaxDecimal", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(decimal) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DecimalArgumentTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DecimalArgumentTests)), - Name = "DecimalArgumentTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DecimalArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DecimalArgumentTests)), + Name = "DecimalArgumentTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DecimalArgumentTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.MaxDecimal(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -478,6 +467,37 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_MaxDecimal__decimal Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DecimalArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DecimalArgumentTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DecimalArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.MaxDecimal(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DecimalArgumentTests_MaxDecimal__decimal_ModuleInitializer { @@ -508,11 +528,7 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_MinDecimal__decimal TestClassType = typeof(global::TUnit.TestProject.DecimalArgumentTests), TestMethodName = "MinDecimal", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("-79228162514264337593543950335"), @@ -541,42 +557,20 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_MinDecimal__decimal ReflectionInfo = typeof(global::TUnit.TestProject.DecimalArgumentTests).GetMethod("MinDecimal", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(decimal) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DecimalArgumentTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DecimalArgumentTests)), - Name = "DecimalArgumentTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DecimalArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DecimalArgumentTests)), + Name = "DecimalArgumentTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DecimalArgumentTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.MinDecimal(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -599,6 +593,37 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_MinDecimal__decimal Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DecimalArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DecimalArgumentTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DecimalArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.MinDecimal(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DecimalArgumentTests_MinDecimal__decimal_ModuleInitializer { @@ -629,11 +654,7 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_ExplicitDecimalValu TestClassType = typeof(global::TUnit.TestProject.DecimalArgumentTests), TestMethodName = "ExplicitDecimalValue", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("123.456"), @@ -662,42 +683,20 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_ExplicitDecimalValu ReflectionInfo = typeof(global::TUnit.TestProject.DecimalArgumentTests).GetMethod("ExplicitDecimalValue", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(decimal) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DecimalArgumentTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DecimalArgumentTests)), - Name = "DecimalArgumentTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DecimalArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DecimalArgumentTests)), + Name = "DecimalArgumentTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DecimalArgumentTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.ExplicitDecimalValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -720,6 +719,37 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_ExplicitDecimalValu Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DecimalArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DecimalArgumentTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DecimalArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.ExplicitDecimalValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DecimalArgumentTests_ExplicitDecimalValue__decimal_ModuleInitializer { @@ -750,11 +780,7 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_MultipleDecimals__d TestClassType = typeof(global::TUnit.TestProject.DecimalArgumentTests), TestMethodName = "MultipleDecimals", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1.1m, 2.2m, 3.3m), @@ -797,42 +823,20 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_MultipleDecimals__d ReflectionInfo = typeof(global::TUnit.TestProject.DecimalArgumentTests).GetMethod("MultipleDecimals", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(decimal), typeof(decimal), typeof(decimal) }, null)!.GetParameters()[2] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DecimalArgumentTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DecimalArgumentTests)), - Name = "DecimalArgumentTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DecimalArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DecimalArgumentTests)), + Name = "DecimalArgumentTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DecimalArgumentTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 3: - { - return new global::System.Threading.Tasks.ValueTask(instance.MultipleDecimals(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -855,6 +859,37 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_MultipleDecimals__d Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DecimalArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DecimalArgumentTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DecimalArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 3: + { + return new global::System.Threading.Tasks.ValueTask(instance.MultipleDecimals(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DecimalArgumentTests_MultipleDecimals__decimal_decimal_decimal_ModuleInitializer { @@ -885,11 +920,7 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_Test__decimal_TestS TestClassType = typeof(global::TUnit.TestProject.DecimalArgumentTests), TestMethodName = "Test", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(0.5m), @@ -920,43 +951,20 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_Test__decimal_TestS ReflectionInfo = typeof(global::TUnit.TestProject.DecimalArgumentTests).GetMethod("Test", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(decimal) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DecimalArgumentTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DecimalArgumentTests)), - Name = "DecimalArgumentTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DecimalArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DecimalArgumentTests)), + Name = "DecimalArgumentTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DecimalArgumentTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.Test(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -979,6 +987,38 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_Test__decimal_TestS Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DecimalArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DecimalArgumentTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DecimalArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.Test(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DecimalArgumentTests_Test__decimal_ModuleInitializer { @@ -1009,11 +1049,7 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_TransactionDiscount TestClassType = typeof(global::TUnit.TestProject.DecimalArgumentTests), TestMethodName = "TransactionDiscountCalculations", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(50m, 75m, 70m, 5m, 0m, true), @@ -1079,43 +1115,20 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_TransactionDiscount ReflectionInfo = typeof(global::TUnit.TestProject.DecimalArgumentTests).GetMethod("TransactionDiscountCalculations", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(decimal), typeof(decimal), typeof(decimal), typeof(decimal), typeof(decimal), typeof(bool) }, null)!.GetParameters()[5] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DecimalArgumentTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DecimalArgumentTests)), - Name = "DecimalArgumentTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DecimalArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DecimalArgumentTests)), + Name = "DecimalArgumentTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DecimalArgumentTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 6: - { - instance.TransactionDiscountCalculations(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]), global::TUnit.Core.Helpers.CastHelper.Cast(args[4]), global::TUnit.Core.Helpers.CastHelper.Cast(args[5])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 6 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1138,6 +1151,38 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_TransactionDiscount Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DecimalArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DecimalArgumentTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DecimalArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 6: + { + instance.TransactionDiscountCalculations(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]), global::TUnit.Core.Helpers.CastHelper.Cast(args[4]), global::TUnit.Core.Helpers.CastHelper.Cast(args[5])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 6 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DecimalArgumentTests_TransactionDiscountCalculations__decimal_decima_54FB9799_ModuleInitializer { @@ -1168,11 +1213,7 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_Equality3__decimal_ TestClassType = typeof(global::TUnit.TestProject.DecimalArgumentTests), TestMethodName = "Equality3", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(2_000.00000000000000001m), @@ -1201,42 +1242,20 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_Equality3__decimal_ ReflectionInfo = typeof(global::TUnit.TestProject.DecimalArgumentTests).GetMethod("Equality3", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(decimal) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DecimalArgumentTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DecimalArgumentTests)), - Name = "DecimalArgumentTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DecimalArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DecimalArgumentTests)), + Name = "DecimalArgumentTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DecimalArgumentTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Equality3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1259,6 +1278,37 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_Equality3__decimal_ Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DecimalArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DecimalArgumentTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DecimalArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.Equality3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DecimalArgumentTests_Equality3__decimal_ModuleInitializer { @@ -1289,11 +1339,7 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_Equality4__decimal_ TestClassType = typeof(global::TUnit.TestProject.DecimalArgumentTests), TestMethodName = "Equality4", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(123_999.00000000000000001m), @@ -1322,42 +1368,20 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_Equality4__decimal_ ReflectionInfo = typeof(global::TUnit.TestProject.DecimalArgumentTests).GetMethod("Equality4", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(decimal) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DecimalArgumentTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DecimalArgumentTests)), - Name = "DecimalArgumentTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DecimalArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DecimalArgumentTests)), + Name = "DecimalArgumentTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DecimalArgumentTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Equality4(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1380,6 +1404,37 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_Equality4__decimal_ Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DecimalArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DecimalArgumentTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DecimalArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.Equality4(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DecimalArgumentTests_Equality4__decimal_ModuleInitializer { @@ -1410,11 +1465,7 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_TestMethod__decimal TestClassType = typeof(global::TUnit.TestProject.DecimalArgumentTests), TestMethodName = "TestMethod", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(42), @@ -1443,42 +1494,20 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_TestMethod__decimal ReflectionInfo = typeof(global::TUnit.TestProject.DecimalArgumentTests).GetMethod("TestMethod", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(decimal) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DecimalArgumentTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DecimalArgumentTests)), - Name = "DecimalArgumentTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DecimalArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DecimalArgumentTests)), + Name = "DecimalArgumentTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.DecimalArgumentTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.TestMethod(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1501,6 +1530,37 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_TestMethod__decimal Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.DecimalArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.DecimalArgumentTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DecimalArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.TestMethod(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_DecimalArgumentTests_TestMethod__decimal_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet10_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet10_0.verified.txt index 3f1e5b2fcb..c6cf4e515e 100644 --- a/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet10_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet10_0.verified.txt @@ -15,10 +15,7 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -35,35 +32,20 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.SynchronousTest(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -86,6 +68,29 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.BasicTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.SynchronousTest(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_BasicTests_SynchronousTest_ModuleInitializer { @@ -116,10 +121,7 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "AsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -136,34 +138,20 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -186,6 +174,28 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.BasicTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_BasicTests_AsynchronousTest_ModuleInitializer { @@ -216,10 +226,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "ValueTaskAsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -236,34 +243,20 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes ReturnType = typeof(global::System.Threading.Tasks.ValueTask), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.ValueTask)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return instance.ValueTaskAsynchronousTest(); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -286,6 +279,28 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.BasicTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return instance.ValueTaskAsynchronousTest(); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_ModuleInitializer { 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 3f1e5b2fcb..c6cf4e515e 100644 --- a/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet8_0.verified.txt @@ -15,10 +15,7 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -35,35 +32,20 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.SynchronousTest(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -86,6 +68,29 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.BasicTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.SynchronousTest(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_BasicTests_SynchronousTest_ModuleInitializer { @@ -116,10 +121,7 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "AsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -136,34 +138,20 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -186,6 +174,28 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.BasicTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_BasicTests_AsynchronousTest_ModuleInitializer { @@ -216,10 +226,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "ValueTaskAsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -236,34 +243,20 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes ReturnType = typeof(global::System.Threading.Tasks.ValueTask), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.ValueTask)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return instance.ValueTaskAsynchronousTest(); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -286,6 +279,28 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.BasicTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return instance.ValueTaskAsynchronousTest(); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_ModuleInitializer { 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 3f1e5b2fcb..c6cf4e515e 100644 --- a/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet9_0.verified.txt @@ -15,10 +15,7 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -35,35 +32,20 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.SynchronousTest(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -86,6 +68,29 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.BasicTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.SynchronousTest(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_BasicTests_SynchronousTest_ModuleInitializer { @@ -116,10 +121,7 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "AsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -136,34 +138,20 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -186,6 +174,28 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.BasicTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_BasicTests_AsynchronousTest_ModuleInitializer { @@ -216,10 +226,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "ValueTaskAsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -236,34 +243,20 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes ReturnType = typeof(global::System.Threading.Tasks.ValueTask), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.ValueTask)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BasicTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "BasicTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "BasicTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.BasicTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return instance.ValueTaskAsynchronousTest(); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -286,6 +279,28 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.BasicTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.BasicTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return instance.ValueTaskAsynchronousTest(); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/EnumMemberNamesTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/EnumMemberNamesTests.Test.verified.txt index f0da3a0012..5b3f479b68 100644 --- a/TUnit.Core.SourceGenerator.Tests/EnumMemberNamesTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/EnumMemberNamesTests.Test.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_Bugs__1432_EnumMemberNamesTests_SomeTest TestClassType = typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests), TestMethodName = "SomeTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("A"), @@ -50,43 +46,20 @@ internal sealed class TUnit_TestProject_Bugs__1432_EnumMemberNamesTests_SomeTest ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests).GetMethod("SomeTest", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests)), - Name = "EnumMemberNamesTests", - Namespace = "TUnit.TestProject.Bugs._1432", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests)), + Name = "EnumMemberNamesTests", + Namespace = "TUnit.TestProject.Bugs._1432", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.SomeTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -109,6 +82,38 @@ internal sealed class TUnit_TestProject_Bugs__1432_EnumMemberNamesTests_SomeTest Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.SomeTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__1432_EnumMemberNamesTests_SomeTest__string_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/EnumerableDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/EnumerableDataSourceDrivenTests.Test.verified.txt index 6b8c41ef25..bc311d5d85 100644 --- a/TUnit.Core.SourceGenerator.Tests/EnumerableDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/EnumerableDataSourceDrivenTests.Test.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_EnumerableDataSourceDrivenTests_DataSour TestClassType = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests), TestMethodName = "DataSource_Method", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -69,42 +65,20 @@ internal sealed class TUnit_TestProject_EnumerableDataSourceDrivenTests_DataSour ReflectionInfo = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests).GetMethod("DataSource_Method", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.EnumerableDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.EnumerableDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests)), - Name = "EnumerableDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests)), + Name = "EnumerableDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.EnumerableDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -127,6 +101,37 @@ internal sealed class TUnit_TestProject_EnumerableDataSourceDrivenTests_DataSour Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.EnumerableDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.EnumerableDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.EnumerableDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_EnumerableDataSourceDrivenTests_DataSource_Method__int_ModuleInitializer { @@ -157,11 +162,7 @@ internal sealed class TUnit_TestProject_EnumerableDataSourceDrivenTests_DataSour TestClassType = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests), TestMethodName = "DataSource_Method2", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -211,42 +212,20 @@ internal sealed class TUnit_TestProject_EnumerableDataSourceDrivenTests_DataSour ReflectionInfo = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests).GetMethod("DataSource_Method2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.EnumerableDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.EnumerableDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests)), - Name = "EnumerableDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests)), + Name = "EnumerableDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.EnumerableDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.DataSource_Method2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -269,6 +248,37 @@ internal sealed class TUnit_TestProject_EnumerableDataSourceDrivenTests_DataSour Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.EnumerableDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.EnumerableDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.EnumerableDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.DataSource_Method2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_EnumerableDataSourceDrivenTests_DataSource_Method2__int_ModuleInitializer { @@ -299,11 +309,7 @@ internal sealed class TUnit_TestProject_EnumerableDataSourceDrivenTests_DataSour TestClassType = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests), TestMethodName = "DataSource_WithBaseReturn", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("MethodWithBaseReturn") @@ -353,43 +359,20 @@ internal sealed class TUnit_TestProject_EnumerableDataSourceDrivenTests_DataSour ReflectionInfo = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests).GetMethod("DataSource_WithBaseReturn", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests.BaseValue) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.EnumerableDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.EnumerableDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests)), - Name = "EnumerableDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests)), + Name = "EnumerableDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.EnumerableDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_WithBaseReturn(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -412,6 +395,38 @@ internal sealed class TUnit_TestProject_EnumerableDataSourceDrivenTests_DataSour Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.EnumerableDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.EnumerableDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.EnumerableDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_WithBaseReturn(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_EnumerableDataSourceDrivenTests_DataSource_WithBaseReturn__BaseValue_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/EnumerableTupleDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/EnumerableTupleDataSourceDrivenTests.Test.verified.txt index 09eb157587..00a1b2fd97 100644 --- a/TUnit.Core.SourceGenerator.Tests/EnumerableTupleDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/EnumerableTupleDataSourceDrivenTests.Test.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_EnumerableTupleDataSourceDrivenTests_Dat TestClassType = typeof(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests), TestMethodName = "DataSource_TupleMethod", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") @@ -105,43 +101,20 @@ internal sealed class TUnit_TestProject_EnumerableTupleDataSourceDrivenTests_Dat ReflectionInfo = typeof(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string), typeof(bool) }, null)!.GetParameters()[2] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests)), - Name = "EnumerableTupleDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests)), + Name = "EnumerableTupleDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 3: - { - instance.DataSource_TupleMethod(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -164,6 +137,38 @@ internal sealed class TUnit_TestProject_EnumerableTupleDataSourceDrivenTests_Dat Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 3: + { + instance.DataSource_TupleMethod(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_EnumerableTupleDataSourceDrivenTests_DataSource_TupleMethod__int_string_bool_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/ExpectedArgumentTypeTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ExpectedArgumentTypeTests.Test.verified.txt index caf56ddf12..a1c4df4cab 100644 --- a/TUnit.Core.SourceGenerator.Tests/ExpectedArgumentTypeTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ExpectedArgumentTypeTests.Test.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_ExpectedArgumentTypeTests_TypedArguments TestClassType = typeof(global::TUnit.TestProject.ExpectedArgumentTypeTests), TestMethodName = "TypedArguments", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(0d, typeof(double)), @@ -67,42 +63,20 @@ internal sealed class TUnit_TestProject_ExpectedArgumentTypeTests_TypedArguments ReflectionInfo = typeof(global::TUnit.TestProject.ExpectedArgumentTypeTests).GetMethod("TypedArguments", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(object), typeof(global::System.Type) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ExpectedArgumentTypeTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ExpectedArgumentTypeTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.ExpectedArgumentTypeTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ExpectedArgumentTypeTests)), - Name = "ExpectedArgumentTypeTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.ExpectedArgumentTypeTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ExpectedArgumentTypeTests)), + Name = "ExpectedArgumentTypeTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.ExpectedArgumentTypeTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.TypedArguments(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -125,6 +99,37 @@ internal sealed class TUnit_TestProject_ExpectedArgumentTypeTests_TypedArguments Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.ExpectedArgumentTypeTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.ExpectedArgumentTypeTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ExpectedArgumentTypeTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 2: + { + return new global::System.Threading.Tasks.ValueTask(instance.TypedArguments(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_ExpectedArgumentTypeTests_TypedArguments__object_Type_ModuleInitializer { @@ -155,11 +160,7 @@ internal sealed class TUnit_TestProject_ExpectedArgumentTypeTests_EnumTypes__obj TestClassType = typeof(global::TUnit.TestProject.ExpectedArgumentTypeTests), TestMethodName = "EnumTypes", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.ByteEnum.Default, typeof(global::TUnit.TestProject.ByteEnum), typeof(byte)), @@ -209,42 +210,20 @@ internal sealed class TUnit_TestProject_ExpectedArgumentTypeTests_EnumTypes__obj ReflectionInfo = typeof(global::TUnit.TestProject.ExpectedArgumentTypeTests).GetMethod("EnumTypes", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(object), typeof(global::System.Type), typeof(global::System.Type) }, null)!.GetParameters()[2] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ExpectedArgumentTypeTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ExpectedArgumentTypeTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.ExpectedArgumentTypeTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ExpectedArgumentTypeTests)), - Name = "ExpectedArgumentTypeTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.ExpectedArgumentTypeTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ExpectedArgumentTypeTests)), + Name = "ExpectedArgumentTypeTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.ExpectedArgumentTypeTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 3: - { - return new global::System.Threading.Tasks.ValueTask(instance.EnumTypes(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -267,6 +246,37 @@ internal sealed class TUnit_TestProject_ExpectedArgumentTypeTests_EnumTypes__obj Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.ExpectedArgumentTypeTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.ExpectedArgumentTypeTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ExpectedArgumentTypeTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 3: + { + return new global::System.Threading.Tasks.ValueTask(instance.EnumTypes(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_ExpectedArgumentTypeTests_EnumTypes__object_Type_Type_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/GenericMethodTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/GenericMethodTests.Test.verified.txt index f632a0ac6f..b098d231ce 100644 --- a/TUnit.Core.SourceGenerator.Tests/GenericMethodTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/GenericMethodTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -82,20 +82,16 @@ internal sealed class TUnit_TestProject_GenericMethodTests_AggregateBy_HasExpect ReflectionInfo = global::System.Linq.Enumerable.FirstOrDefault(typeof(global::TUnit.TestProject.GenericMethodTests).GetMethods(global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance | global::System.Reflection.BindingFlags.Static), m => m.Name == "AggregateBy_HasExpectedOutput" && m.GetParameters().Length == 6)?.GetParameters()[5]! } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.GenericMethodTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.GenericMethodTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.GenericMethodTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.GenericMethodTests)), - Name = "GenericMethodTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.GenericMethodTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.GenericMethodTests)), + Name = "GenericMethodTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -226,20 +222,16 @@ internal sealed class TUnit_TestProject_GenericMethodTests_AggregateBy_HasExpect ReflectionInfo = global::System.Linq.Enumerable.FirstOrDefault(typeof(global::TUnit.TestProject.GenericMethodTests).GetMethods(global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance | global::System.Reflection.BindingFlags.Static), m => m.Name == "AggregateBy_HasExpectedOutput" && m.GetParameters().Length == 6)?.GetParameters()[5]! } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.GenericMethodTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.GenericMethodTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.GenericMethodTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.GenericMethodTests)), - Name = "GenericMethodTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.GenericMethodTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.GenericMethodTests)), + Name = "GenericMethodTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -382,20 +374,16 @@ internal sealed class TUnit_TestProject_GenericMethodTests_AggregateBy_HasExpect ReflectionInfo = global::System.Linq.Enumerable.FirstOrDefault(typeof(global::TUnit.TestProject.GenericMethodTests).GetMethods(global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance | global::System.Reflection.BindingFlags.Static), m => m.Name == "AggregateBy_HasExpectedOutput" && m.GetParameters().Length == 6)?.GetParameters()[5]! } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.GenericMethodTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.GenericMethodTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.GenericMethodTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.GenericMethodTests)), - Name = "GenericMethodTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.GenericMethodTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.GenericMethodTests)), + Name = "GenericMethodTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => diff --git a/TUnit.Core.SourceGenerator.Tests/GenericMethodWithDataSourceTests.Generic_Method_With_MethodDataSource_Should_Generate_Tests.verified.txt b/TUnit.Core.SourceGenerator.Tests/GenericMethodWithDataSourceTests.Generic_Method_With_MethodDataSource_Should_Generate_Tests.verified.txt index 4d2073bad5..4de6f2be85 100644 --- a/TUnit.Core.SourceGenerator.Tests/GenericMethodWithDataSourceTests.Generic_Method_With_MethodDataSource_Should_Generate_Tests.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/GenericMethodWithDataSourceTests.Generic_Method_With_MethodDataSource_Should_Generate_Tests.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -40,20 +40,16 @@ internal sealed class TUnit_TestProject_Bugs__4431_GenericClassNoDataSource_T_Sh ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassNoDataSource<>", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassNoDataSource<>", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassNoDataSource<>), - TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassNoDataSource<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), - Name = "GenericClassNoDataSource", - Namespace = "TUnit.TestProject.Bugs._4431", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassNoDataSource<>), + TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassNoDataSource<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), + Name = "GenericClassNoDataSource", + Namespace = "TUnit.TestProject.Bugs._4431", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -99,20 +95,16 @@ internal sealed class TUnit_TestProject_Bugs__4431_GenericClassNoDataSource_T_Sh ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassNoDataSource<>", static () => - { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassNoDataSource<>), - TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassNoDataSource<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), - Name = "GenericClassNoDataSource", - Namespace = "TUnit.TestProject.Bugs._4431", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassNoDataSource<>", new global::TUnit.Core.ClassMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassNoDataSource<>), + TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassNoDataSource<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), + Name = "GenericClassNoDataSource", + Namespace = "TUnit.TestProject.Bugs._4431", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -164,20 +156,16 @@ internal sealed class TUnit_TestProject_Bugs__4431_GenericClassNoDataSource_T_Sh ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassNoDataSource<>", static () => - { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassNoDataSource<>), - TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassNoDataSource<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), - Name = "GenericClassNoDataSource", - Namespace = "TUnit.TestProject.Bugs._4431", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassNoDataSource<>", new global::TUnit.Core.ClassMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassNoDataSource<>), + TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassNoDataSource<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), + Name = "GenericClassNoDataSource", + Namespace = "TUnit.TestProject.Bugs._4431", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -286,20 +274,16 @@ internal sealed class TUnit_TestProject_Bugs__4431_GenericClassWithMethodDataSou ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource<>).GetMethod("Should_Have_Number", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource<>", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource<>", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource<>), - TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), - Name = "GenericClassWithMethodDataSource", - Namespace = "TUnit.TestProject.Bugs._4431", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource<>), + TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), + Name = "GenericClassWithMethodDataSource", + Namespace = "TUnit.TestProject.Bugs._4431", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -379,20 +363,16 @@ internal sealed class TUnit_TestProject_Bugs__4431_GenericClassWithMethodDataSou ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource<>).GetMethod("Should_Have_Number", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource<>", static () => - { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource<>), - TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), - Name = "GenericClassWithMethodDataSource", - Namespace = "TUnit.TestProject.Bugs._4431", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource<>", new global::TUnit.Core.ClassMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource<>), + TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), + Name = "GenericClassWithMethodDataSource", + Namespace = "TUnit.TestProject.Bugs._4431", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -478,20 +458,16 @@ internal sealed class TUnit_TestProject_Bugs__4431_GenericClassWithMethodDataSou ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource<>).GetMethod("Should_Have_Number", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource<>", static () => - { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource<>), - TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), - Name = "GenericClassWithMethodDataSource", - Namespace = "TUnit.TestProject.Bugs._4431", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource<>", new global::TUnit.Core.ClassMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource<>), + TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), + Name = "GenericClassWithMethodDataSource", + Namespace = "TUnit.TestProject.Bugs._4431", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -592,20 +568,16 @@ internal sealed class TUnit_TestProject_Bugs__4431_NonGenericClassWithGenericMet ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod)), - Name = "NonGenericClassWithGenericMethod", - Namespace = "TUnit.TestProject.Bugs._4431", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod)), + Name = "NonGenericClassWithGenericMethod", + Namespace = "TUnit.TestProject.Bugs._4431", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -647,20 +619,16 @@ internal sealed class TUnit_TestProject_Bugs__4431_NonGenericClassWithGenericMet ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod", static () => - { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod)), - Name = "NonGenericClassWithGenericMethod", - Namespace = "TUnit.TestProject.Bugs._4431", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod", new global::TUnit.Core.ClassMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod)), + Name = "NonGenericClassWithGenericMethod", + Namespace = "TUnit.TestProject.Bugs._4431", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -714,20 +682,16 @@ internal sealed class TUnit_TestProject_Bugs__4431_NonGenericClassWithGenericMet ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod", static () => - { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod)), - Name = "NonGenericClassWithGenericMethod", - Namespace = "TUnit.TestProject.Bugs._4431", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod", new global::TUnit.Core.ClassMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod)), + Name = "NonGenericClassWithGenericMethod", + Namespace = "TUnit.TestProject.Bugs._4431", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -781,20 +745,16 @@ internal sealed class TUnit_TestProject_Bugs__4431_NonGenericClassWithGenericMet ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod", static () => - { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod)), - Name = "NonGenericClassWithGenericMethod", - Namespace = "TUnit.TestProject.Bugs._4431", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod", new global::TUnit.Core.ClassMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod)), + Name = "NonGenericClassWithGenericMethod", + Namespace = "TUnit.TestProject.Bugs._4431", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -903,20 +863,16 @@ internal sealed class TUnit_TestProject_Bugs__4431_NonGenericClassWithGenericMet ReflectionInfo = global::System.Linq.Enumerable.FirstOrDefault(typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource).GetMethods(global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance | global::System.Reflection.BindingFlags.Static), m => m.Name == "GenericMethod_With_DataSource" && m.GetParameters().Length == 1)?.GetParameters()[0]! } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource)), - Name = "NonGenericClassWithGenericMethodAndDataSource", - Namespace = "TUnit.TestProject.Bugs._4431", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource)), + Name = "NonGenericClassWithGenericMethodAndDataSource", + Namespace = "TUnit.TestProject.Bugs._4431", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -991,20 +947,16 @@ internal sealed class TUnit_TestProject_Bugs__4431_NonGenericClassWithGenericMet ReflectionInfo = global::System.Linq.Enumerable.FirstOrDefault(typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource).GetMethods(global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance | global::System.Reflection.BindingFlags.Static), m => m.Name == "GenericMethod_With_DataSource" && m.GetParameters().Length == 1)?.GetParameters()[0]! } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource", static () => - { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource)), - Name = "NonGenericClassWithGenericMethodAndDataSource", - Namespace = "TUnit.TestProject.Bugs._4431", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource", new global::TUnit.Core.ClassMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource)), + Name = "NonGenericClassWithGenericMethodAndDataSource", + Namespace = "TUnit.TestProject.Bugs._4431", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -1091,20 +1043,16 @@ internal sealed class TUnit_TestProject_Bugs__4431_NonGenericClassWithGenericMet ReflectionInfo = global::System.Linq.Enumerable.FirstOrDefault(typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource).GetMethods(global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance | global::System.Reflection.BindingFlags.Static), m => m.Name == "GenericMethod_With_DataSource" && m.GetParameters().Length == 1)?.GetParameters()[0]! } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource", static () => - { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource)), - Name = "NonGenericClassWithGenericMethodAndDataSource", - Namespace = "TUnit.TestProject.Bugs._4431", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource", new global::TUnit.Core.ClassMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource)), + Name = "NonGenericClassWithGenericMethodAndDataSource", + Namespace = "TUnit.TestProject.Bugs._4431", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -1206,20 +1154,16 @@ internal sealed class TUnit_TestProject_Bugs__4431_GenericClassWithGenericMethod ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod<>", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod<>", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod<>), - TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod<>), [new global::TUnit.Core.GenericParameter(0, false, "TClass")]), - Name = "GenericClassWithGenericMethod", - Namespace = "TUnit.TestProject.Bugs._4431", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod<>), + TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod<>), [new global::TUnit.Core.GenericParameter(0, false, "TClass")]), + Name = "GenericClassWithGenericMethod", + Namespace = "TUnit.TestProject.Bugs._4431", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -1268,20 +1212,16 @@ internal sealed class TUnit_TestProject_Bugs__4431_GenericClassWithGenericMethod ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod<>", static () => - { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod<>), - TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod<>), [new global::TUnit.Core.GenericParameter(0, false, "TClass")]), - Name = "GenericClassWithGenericMethod", - Namespace = "TUnit.TestProject.Bugs._4431", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod<>", new global::TUnit.Core.ClassMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod<>), + TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod<>), [new global::TUnit.Core.GenericParameter(0, false, "TClass")]), + Name = "GenericClassWithGenericMethod", + Namespace = "TUnit.TestProject.Bugs._4431", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -1336,20 +1276,16 @@ internal sealed class TUnit_TestProject_Bugs__4431_GenericClassWithGenericMethod ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod<>", static () => - { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod<>), - TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod<>), [new global::TUnit.Core.GenericParameter(0, false, "TClass")]), - Name = "GenericClassWithGenericMethod", - Namespace = "TUnit.TestProject.Bugs._4431", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod<>", new global::TUnit.Core.ClassMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod<>), + TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod<>), [new global::TUnit.Core.GenericParameter(0, false, "TClass")]), + Name = "GenericClassWithGenericMethod", + Namespace = "TUnit.TestProject.Bugs._4431", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -1404,20 +1340,16 @@ internal sealed class TUnit_TestProject_Bugs__4431_GenericClassWithGenericMethod ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod<>", static () => - { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod<>), - TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod<>), [new global::TUnit.Core.GenericParameter(0, false, "TClass")]), - Name = "GenericClassWithGenericMethod", - Namespace = "TUnit.TestProject.Bugs._4431", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod<>", new global::TUnit.Core.ClassMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod<>), + TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod<>), [new global::TUnit.Core.GenericParameter(0, false, "TClass")]), + Name = "GenericClassWithGenericMethod", + Namespace = "TUnit.TestProject.Bugs._4431", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -1472,20 +1404,16 @@ internal sealed class TUnit_TestProject_Bugs__4431_GenericClassWithGenericMethod ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod<>", static () => - { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod<>), - TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod<>), [new global::TUnit.Core.GenericParameter(0, false, "TClass")]), - Name = "GenericClassWithGenericMethod", - Namespace = "TUnit.TestProject.Bugs._4431", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod<>", new global::TUnit.Core.ClassMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod<>), + TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod<>), [new global::TUnit.Core.GenericParameter(0, false, "TClass")]), + Name = "GenericClassWithGenericMethod", + Namespace = "TUnit.TestProject.Bugs._4431", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -1585,20 +1513,16 @@ internal sealed class TUnit_TestProject_Bugs__4431_GenericClassWithConstructor_T ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassWithConstructor<>", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassWithConstructor<>", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithConstructor<>), - TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithConstructor<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), - Name = "GenericClassWithConstructor", - Namespace = "TUnit.TestProject.Bugs._4431", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithConstructor<>), + TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithConstructor<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), + Name = "GenericClassWithConstructor", + Namespace = "TUnit.TestProject.Bugs._4431", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -1644,20 +1568,16 @@ internal sealed class TUnit_TestProject_Bugs__4431_GenericClassWithConstructor_T ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassWithConstructor<>", static () => - { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithConstructor<>), - TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithConstructor<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), - Name = "GenericClassWithConstructor", - Namespace = "TUnit.TestProject.Bugs._4431", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassWithConstructor<>", new global::TUnit.Core.ClassMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithConstructor<>), + TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithConstructor<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), + Name = "GenericClassWithConstructor", + Namespace = "TUnit.TestProject.Bugs._4431", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -1709,20 +1629,16 @@ internal sealed class TUnit_TestProject_Bugs__4431_GenericClassWithConstructor_T ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassWithConstructor<>", static () => - { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithConstructor<>), - TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithConstructor<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), - Name = "GenericClassWithConstructor", - Namespace = "TUnit.TestProject.Bugs._4431", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassWithConstructor<>", new global::TUnit.Core.ClassMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithConstructor<>), + TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithConstructor<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), + Name = "GenericClassWithConstructor", + Namespace = "TUnit.TestProject.Bugs._4431", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -1822,20 +1738,16 @@ internal sealed class TUnit_TestProject_Bugs__4431_MultipleTypeParameters_T1_T2_ ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.MultipleTypeParameters<,>", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.MultipleTypeParameters<,>", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._4431.MultipleTypeParameters<,>), - TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.MultipleTypeParameters<,>), [new global::TUnit.Core.GenericParameter(0, false, "T1"), new global::TUnit.Core.GenericParameter(1, false, "T2")]), - Name = "MultipleTypeParameters", - Namespace = "TUnit.TestProject.Bugs._4431", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._4431.MultipleTypeParameters<,>), + TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.MultipleTypeParameters<,>), [new global::TUnit.Core.GenericParameter(0, false, "T1"), new global::TUnit.Core.GenericParameter(1, false, "T2")]), + Name = "MultipleTypeParameters", + Namespace = "TUnit.TestProject.Bugs._4431", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -1881,20 +1793,16 @@ internal sealed class TUnit_TestProject_Bugs__4431_MultipleTypeParameters_T1_T2_ ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.MultipleTypeParameters<,>", static () => - { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._4431.MultipleTypeParameters<,>), - TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.MultipleTypeParameters<,>), [new global::TUnit.Core.GenericParameter(0, false, "T1"), new global::TUnit.Core.GenericParameter(1, false, "T2")]), - Name = "MultipleTypeParameters", - Namespace = "TUnit.TestProject.Bugs._4431", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.MultipleTypeParameters<,>", new global::TUnit.Core.ClassMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._4431.MultipleTypeParameters<,>), + TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.MultipleTypeParameters<,>), [new global::TUnit.Core.GenericParameter(0, false, "T1"), new global::TUnit.Core.GenericParameter(1, false, "T2")]), + Name = "MultipleTypeParameters", + Namespace = "TUnit.TestProject.Bugs._4431", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -1946,20 +1854,16 @@ internal sealed class TUnit_TestProject_Bugs__4431_MultipleTypeParameters_T1_T2_ ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.MultipleTypeParameters<,>", static () => - { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._4431.MultipleTypeParameters<,>), - TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.MultipleTypeParameters<,>), [new global::TUnit.Core.GenericParameter(0, false, "T1"), new global::TUnit.Core.GenericParameter(1, false, "T2")]), - Name = "MultipleTypeParameters", - Namespace = "TUnit.TestProject.Bugs._4431", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.MultipleTypeParameters<,>", new global::TUnit.Core.ClassMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._4431.MultipleTypeParameters<,>), + TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.MultipleTypeParameters<,>), [new global::TUnit.Core.GenericParameter(0, false, "T1"), new global::TUnit.Core.GenericParameter(1, false, "T2")]), + Name = "MultipleTypeParameters", + Namespace = "TUnit.TestProject.Bugs._4431", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -2059,20 +1963,16 @@ internal sealed class TUnit_TestProject_Bugs__4431_DerivedGenericClass_T_Should_ ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.DerivedGenericClass<>", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.DerivedGenericClass<>", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._4431.DerivedGenericClass<>), - TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.DerivedGenericClass<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), - Name = "DerivedGenericClass", - Namespace = "TUnit.TestProject.Bugs._4431", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._4431.DerivedGenericClass<>), + TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.DerivedGenericClass<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), + Name = "DerivedGenericClass", + Namespace = "TUnit.TestProject.Bugs._4431", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -2118,20 +2018,16 @@ internal sealed class TUnit_TestProject_Bugs__4431_DerivedGenericClass_T_Should_ ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.DerivedGenericClass<>", static () => - { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._4431.DerivedGenericClass<>), - TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.DerivedGenericClass<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), - Name = "DerivedGenericClass", - Namespace = "TUnit.TestProject.Bugs._4431", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.DerivedGenericClass<>", new global::TUnit.Core.ClassMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._4431.DerivedGenericClass<>), + TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.DerivedGenericClass<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), + Name = "DerivedGenericClass", + Namespace = "TUnit.TestProject.Bugs._4431", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -2183,20 +2079,16 @@ internal sealed class TUnit_TestProject_Bugs__4431_DerivedGenericClass_T_Should_ ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.DerivedGenericClass<>", static () => - { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._4431.DerivedGenericClass<>), - TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.DerivedGenericClass<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), - Name = "DerivedGenericClass", - Namespace = "TUnit.TestProject.Bugs._4431", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.DerivedGenericClass<>", new global::TUnit.Core.ClassMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._4431.DerivedGenericClass<>), + TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.DerivedGenericClass<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), + Name = "DerivedGenericClass", + Namespace = "TUnit.TestProject.Bugs._4431", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -2322,38 +2214,29 @@ internal sealed class TUnit_TestProject_Bugs__4431_GenericClassWithClassDataSour ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource<>", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource<>", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource<>), - TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), - Name = "GenericClassWithClassDataSource", - Namespace = "TUnit.TestProject.Bugs._4431", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = new global::TUnit.Core.PropertyMetadata[] - { - new global::TUnit.Core.PropertyMetadata - { - ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource<>).GetProperty("DataSource"), - Type = typeof(global::TUnit.TestProject.Bugs._4431.TestDataSource), - Name = "DataSource", - IsStatic = false, - IsNullable = false, - Getter = o => ((dynamic)o).DataSource, - ClassMetadata = null!, - ContainingTypeMetadata = null! - } - }, - Parent = null - }; - foreach (var prop in classMetadata.Properties) - { - prop.ClassMetadata = classMetadata; - prop.ContainingTypeMetadata = classMetadata; - } - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource<>), + TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), + Name = "GenericClassWithClassDataSource", + Namespace = "TUnit.TestProject.Bugs._4431", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = new global::TUnit.Core.PropertyMetadata[] + { + new global::TUnit.Core.PropertyMetadata + { + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource<>).GetProperty("DataSource"), + Type = typeof(global::TUnit.TestProject.Bugs._4431.TestDataSource), + Name = "DataSource", + IsStatic = false, + IsNullable = false, + Getter = o => ((dynamic)o).DataSource, + ClassMetadata = null!, + ContainingTypeMetadata = null! + } + }, + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -2425,38 +2308,29 @@ internal sealed class TUnit_TestProject_Bugs__4431_GenericClassWithClassDataSour ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource<>", static () => - { - var classMetadata = new global::TUnit.Core.ClassMetadata + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource<>", new global::TUnit.Core.ClassMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource<>), + TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), + Name = "GenericClassWithClassDataSource", + Namespace = "TUnit.TestProject.Bugs._4431", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = new global::TUnit.Core.PropertyMetadata[] { - Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource<>), - TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), - Name = "GenericClassWithClassDataSource", - Namespace = "TUnit.TestProject.Bugs._4431", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = new global::TUnit.Core.PropertyMetadata[] + new global::TUnit.Core.PropertyMetadata { - new global::TUnit.Core.PropertyMetadata - { - ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource<>).GetProperty("DataSource"), - Type = typeof(global::TUnit.TestProject.Bugs._4431.TestDataSource), - Name = "DataSource", - IsStatic = false, - IsNullable = false, - Getter = o => ((dynamic)o).DataSource, - ClassMetadata = null!, - ContainingTypeMetadata = null! - } - }, - Parent = null - }; - foreach (var prop in classMetadata.Properties) - { - prop.ClassMetadata = classMetadata; - prop.ContainingTypeMetadata = classMetadata; - } - return classMetadata; + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource<>).GetProperty("DataSource"), + Type = typeof(global::TUnit.TestProject.Bugs._4431.TestDataSource), + Name = "DataSource", + IsStatic = false, + IsNullable = false, + Getter = o => ((dynamic)o).DataSource, + ClassMetadata = null!, + ContainingTypeMetadata = null! + } + }, + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -2534,38 +2408,29 @@ internal sealed class TUnit_TestProject_Bugs__4431_GenericClassWithClassDataSour ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource<>", static () => - { - var classMetadata = new global::TUnit.Core.ClassMetadata + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource<>", new global::TUnit.Core.ClassMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource<>), + TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), + Name = "GenericClassWithClassDataSource", + Namespace = "TUnit.TestProject.Bugs._4431", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = new global::TUnit.Core.PropertyMetadata[] { - Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource<>), - TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), - Name = "GenericClassWithClassDataSource", - Namespace = "TUnit.TestProject.Bugs._4431", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = new global::TUnit.Core.PropertyMetadata[] + new global::TUnit.Core.PropertyMetadata { - new global::TUnit.Core.PropertyMetadata - { - ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource<>).GetProperty("DataSource"), - Type = typeof(global::TUnit.TestProject.Bugs._4431.TestDataSource), - Name = "DataSource", - IsStatic = false, - IsNullable = false, - Getter = o => ((dynamic)o).DataSource, - ClassMetadata = null!, - ContainingTypeMetadata = null! - } - }, - Parent = null - }; - foreach (var prop in classMetadata.Properties) - { - prop.ClassMetadata = classMetadata; - prop.ContainingTypeMetadata = classMetadata; - } - return classMetadata; + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource<>).GetProperty("DataSource"), + Type = typeof(global::TUnit.TestProject.Bugs._4431.TestDataSource), + Name = "DataSource", + IsStatic = false, + IsNullable = false, + Getter = o => ((dynamic)o).DataSource, + ClassMetadata = null!, + ContainingTypeMetadata = null! + } + }, + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -2702,38 +2567,29 @@ internal sealed class TUnit_TestProject_Bugs__4431_GenericClassGenericMethodWith ReflectionInfo = global::System.Linq.Enumerable.FirstOrDefault(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>).GetMethods(global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance | global::System.Reflection.BindingFlags.Static), m => m.Name == "FullyGeneric_With_DataSources" && m.GetParameters().Length == 1)?.GetParameters()[0]! } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>), - TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>), [new global::TUnit.Core.GenericParameter(0, false, "TClass")]), - Name = "GenericClassGenericMethodWithDataSources", - Namespace = "TUnit.TestProject.Bugs._4431", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = new global::TUnit.Core.PropertyMetadata[] - { - new global::TUnit.Core.PropertyMetadata - { - ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>).GetProperty("DataSource"), - Type = typeof(global::TUnit.TestProject.Bugs._4431.TestDataSource), - Name = "DataSource", - IsStatic = false, - IsNullable = false, - Getter = o => ((dynamic)o).DataSource, - ClassMetadata = null!, - ContainingTypeMetadata = null! - } - }, - Parent = null - }; - foreach (var prop in classMetadata.Properties) - { - prop.ClassMetadata = classMetadata; - prop.ContainingTypeMetadata = classMetadata; - } - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>), + TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>), [new global::TUnit.Core.GenericParameter(0, false, "TClass")]), + Name = "GenericClassGenericMethodWithDataSources", + Namespace = "TUnit.TestProject.Bugs._4431", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = new global::TUnit.Core.PropertyMetadata[] + { + new global::TUnit.Core.PropertyMetadata + { + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>).GetProperty("DataSource"), + Type = typeof(global::TUnit.TestProject.Bugs._4431.TestDataSource), + Name = "DataSource", + IsStatic = false, + IsNullable = false, + Getter = o => ((dynamic)o).DataSource, + ClassMetadata = null!, + ContainingTypeMetadata = null! + } + }, + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -2842,38 +2698,29 @@ internal sealed class TUnit_TestProject_Bugs__4431_GenericClassGenericMethodWith ReflectionInfo = global::System.Linq.Enumerable.FirstOrDefault(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>).GetMethods(global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance | global::System.Reflection.BindingFlags.Static), m => m.Name == "FullyGeneric_With_DataSources" && m.GetParameters().Length == 1)?.GetParameters()[0]! } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>", static () => - { - var classMetadata = new global::TUnit.Core.ClassMetadata + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>", new global::TUnit.Core.ClassMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>), + TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>), [new global::TUnit.Core.GenericParameter(0, false, "TClass")]), + Name = "GenericClassGenericMethodWithDataSources", + Namespace = "TUnit.TestProject.Bugs._4431", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = new global::TUnit.Core.PropertyMetadata[] { - Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>), - TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>), [new global::TUnit.Core.GenericParameter(0, false, "TClass")]), - Name = "GenericClassGenericMethodWithDataSources", - Namespace = "TUnit.TestProject.Bugs._4431", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = new global::TUnit.Core.PropertyMetadata[] + new global::TUnit.Core.PropertyMetadata { - new global::TUnit.Core.PropertyMetadata - { - ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>).GetProperty("DataSource"), - Type = typeof(global::TUnit.TestProject.Bugs._4431.TestDataSource), - Name = "DataSource", - IsStatic = false, - IsNullable = false, - Getter = o => ((dynamic)o).DataSource, - ClassMetadata = null!, - ContainingTypeMetadata = null! - } - }, - Parent = null - }; - foreach (var prop in classMetadata.Properties) - { - prop.ClassMetadata = classMetadata; - prop.ContainingTypeMetadata = classMetadata; - } - return classMetadata; + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>).GetProperty("DataSource"), + Type = typeof(global::TUnit.TestProject.Bugs._4431.TestDataSource), + Name = "DataSource", + IsStatic = false, + IsNullable = false, + Getter = o => ((dynamic)o).DataSource, + ClassMetadata = null!, + ContainingTypeMetadata = null! + } + }, + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -2988,38 +2835,29 @@ internal sealed class TUnit_TestProject_Bugs__4431_GenericClassGenericMethodWith ReflectionInfo = global::System.Linq.Enumerable.FirstOrDefault(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>).GetMethods(global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance | global::System.Reflection.BindingFlags.Static), m => m.Name == "FullyGeneric_With_DataSources" && m.GetParameters().Length == 1)?.GetParameters()[0]! } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>", static () => - { - var classMetadata = new global::TUnit.Core.ClassMetadata + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>", new global::TUnit.Core.ClassMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>), + TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>), [new global::TUnit.Core.GenericParameter(0, false, "TClass")]), + Name = "GenericClassGenericMethodWithDataSources", + Namespace = "TUnit.TestProject.Bugs._4431", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = new global::TUnit.Core.PropertyMetadata[] { - Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>), - TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>), [new global::TUnit.Core.GenericParameter(0, false, "TClass")]), - Name = "GenericClassGenericMethodWithDataSources", - Namespace = "TUnit.TestProject.Bugs._4431", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = new global::TUnit.Core.PropertyMetadata[] + new global::TUnit.Core.PropertyMetadata { - new global::TUnit.Core.PropertyMetadata - { - ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>).GetProperty("DataSource"), - Type = typeof(global::TUnit.TestProject.Bugs._4431.TestDataSource), - Name = "DataSource", - IsStatic = false, - IsNullable = false, - Getter = o => ((dynamic)o).DataSource, - ClassMetadata = null!, - ContainingTypeMetadata = null! - } - }, - Parent = null - }; - foreach (var prop in classMetadata.Properties) - { - prop.ClassMetadata = classMetadata; - prop.ContainingTypeMetadata = classMetadata; - } - return classMetadata; + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>).GetProperty("DataSource"), + Type = typeof(global::TUnit.TestProject.Bugs._4431.TestDataSource), + Name = "DataSource", + IsStatic = false, + IsNullable = false, + Getter = o => ((dynamic)o).DataSource, + ClassMetadata = null!, + ContainingTypeMetadata = null! + } + }, + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -3134,38 +2972,29 @@ internal sealed class TUnit_TestProject_Bugs__4431_GenericClassGenericMethodWith ReflectionInfo = global::System.Linq.Enumerable.FirstOrDefault(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>).GetMethods(global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance | global::System.Reflection.BindingFlags.Static), m => m.Name == "FullyGeneric_With_DataSources" && m.GetParameters().Length == 1)?.GetParameters()[0]! } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>", static () => - { - var classMetadata = new global::TUnit.Core.ClassMetadata + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>", new global::TUnit.Core.ClassMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>), + TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>), [new global::TUnit.Core.GenericParameter(0, false, "TClass")]), + Name = "GenericClassGenericMethodWithDataSources", + Namespace = "TUnit.TestProject.Bugs._4431", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = new global::TUnit.Core.PropertyMetadata[] { - Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>), - TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>), [new global::TUnit.Core.GenericParameter(0, false, "TClass")]), - Name = "GenericClassGenericMethodWithDataSources", - Namespace = "TUnit.TestProject.Bugs._4431", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = new global::TUnit.Core.PropertyMetadata[] + new global::TUnit.Core.PropertyMetadata { - new global::TUnit.Core.PropertyMetadata - { - ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>).GetProperty("DataSource"), - Type = typeof(global::TUnit.TestProject.Bugs._4431.TestDataSource), - Name = "DataSource", - IsStatic = false, - IsNullable = false, - Getter = o => ((dynamic)o).DataSource, - ClassMetadata = null!, - ContainingTypeMetadata = null! - } - }, - Parent = null - }; - foreach (var prop in classMetadata.Properties) - { - prop.ClassMetadata = classMetadata; - prop.ContainingTypeMetadata = classMetadata; - } - return classMetadata; + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>).GetProperty("DataSource"), + Type = typeof(global::TUnit.TestProject.Bugs._4431.TestDataSource), + Name = "DataSource", + IsStatic = false, + IsNullable = false, + Getter = o => ((dynamic)o).DataSource, + ClassMetadata = null!, + ContainingTypeMetadata = null! + } + }, + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -3280,38 +3109,29 @@ internal sealed class TUnit_TestProject_Bugs__4431_GenericClassGenericMethodWith ReflectionInfo = global::System.Linq.Enumerable.FirstOrDefault(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>).GetMethods(global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance | global::System.Reflection.BindingFlags.Static), m => m.Name == "FullyGeneric_With_DataSources" && m.GetParameters().Length == 1)?.GetParameters()[0]! } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>", static () => - { - var classMetadata = new global::TUnit.Core.ClassMetadata + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>", new global::TUnit.Core.ClassMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>), + TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>), [new global::TUnit.Core.GenericParameter(0, false, "TClass")]), + Name = "GenericClassGenericMethodWithDataSources", + Namespace = "TUnit.TestProject.Bugs._4431", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = new global::TUnit.Core.PropertyMetadata[] { - Type = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>), - TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>), [new global::TUnit.Core.GenericParameter(0, false, "TClass")]), - Name = "GenericClassGenericMethodWithDataSources", - Namespace = "TUnit.TestProject.Bugs._4431", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = new global::TUnit.Core.PropertyMetadata[] + new global::TUnit.Core.PropertyMetadata { - new global::TUnit.Core.PropertyMetadata - { - ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>).GetProperty("DataSource"), - Type = typeof(global::TUnit.TestProject.Bugs._4431.TestDataSource), - Name = "DataSource", - IsStatic = false, - IsNullable = false, - Getter = o => ((dynamic)o).DataSource, - ClassMetadata = null!, - ContainingTypeMetadata = null! - } - }, - Parent = null - }; - foreach (var prop in classMetadata.Properties) - { - prop.ClassMetadata = classMetadata; - prop.ContainingTypeMetadata = classMetadata; - } - return classMetadata; + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>).GetProperty("DataSource"), + Type = typeof(global::TUnit.TestProject.Bugs._4431.TestDataSource), + Name = "DataSource", + IsStatic = false, + IsNullable = false, + Getter = o => ((dynamic)o).DataSource, + ClassMetadata = null!, + ContainingTypeMetadata = null! + } + }, + Parent = null }) }, InstanceFactory = static (typeArgs, args) => 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 6d885c506f..81c0e901f7 100644 --- a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_EmptyGenericRegistry_WhenNoGenericsFound.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_EmptyGenericRegistry_WhenNoGenericsFound.verified.txt @@ -15,10 +15,7 @@ internal sealed class TUnit_TestProject_SimpleTestClass_NonGenericTest_TestSourc TestClassType = typeof(global::TUnit.TestProject.SimpleTestClass), TestMethodName = "NonGenericTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -35,35 +32,20 @@ internal sealed class TUnit_TestProject_SimpleTestClass_NonGenericTest_TestSourc ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("GenericTypeResolverTests:global::TUnit.TestProject.SimpleTestClass", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("GenericTypeResolverTests:global::TUnit.TestProject.SimpleTestClass", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.SimpleTestClass), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.SimpleTestClass)), - Name = "SimpleTestClass", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("GenericTypeResolverTests", static () => new global::TUnit.Core.AssemblyMetadata { Name = "GenericTypeResolverTests" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.SimpleTestClass), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.SimpleTestClass)), + Name = "SimpleTestClass", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("GenericTypeResolverTests", "GenericTypeResolverTests"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.SimpleTestClass(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.NonGenericTest(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -86,6 +68,29 @@ internal sealed class TUnit_TestProject_SimpleTestClass_NonGenericTest_TestSourc Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.SimpleTestClass __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.SimpleTestClass(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.SimpleTestClass instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.NonGenericTest(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_SimpleTestClass_NonGenericTest_ModuleInitializer { 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 f3b68e2ec6..c32f8848ac 100644 --- a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_GenericConstraints_WithInstantiation.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_GenericConstraints_WithInstantiation.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -39,20 +39,16 @@ internal sealed class TUnit_TestProject_ConstrainedGenericTestClass_T_TestMethod ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("GenericTypeResolverTests:global::TUnit.TestProject.ConstrainedGenericTestClass<>", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("GenericTypeResolverTests:global::TUnit.TestProject.ConstrainedGenericTestClass<>", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.ConstrainedGenericTestClass<>), - TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.ConstrainedGenericTestClass<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), - Name = "ConstrainedGenericTestClass", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("GenericTypeResolverTests", static () => new global::TUnit.Core.AssemblyMetadata { Name = "GenericTypeResolverTests" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.ConstrainedGenericTestClass<>), + TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.ConstrainedGenericTestClass<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), + Name = "ConstrainedGenericTestClass", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("GenericTypeResolverTests", "GenericTypeResolverTests"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -97,20 +93,16 @@ internal sealed class TUnit_TestProject_ConstrainedGenericTestClass_T_TestMethod ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("GenericTypeResolverTests:global::TUnit.TestProject.ConstrainedGenericTestClass<>", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("GenericTypeResolverTests:global::TUnit.TestProject.ConstrainedGenericTestClass<>", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.ConstrainedGenericTestClass<>), - TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.ConstrainedGenericTestClass<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), - Name = "ConstrainedGenericTestClass", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("GenericTypeResolverTests", static () => new global::TUnit.Core.AssemblyMetadata { Name = "GenericTypeResolverTests" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.ConstrainedGenericTestClass<>), + TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.ConstrainedGenericTestClass<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), + Name = "ConstrainedGenericTestClass", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("GenericTypeResolverTests", "GenericTypeResolverTests"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -161,20 +153,16 @@ internal sealed class TUnit_TestProject_ConstrainedGenericTestClass_T_TestMethod ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("GenericTypeResolverTests:global::TUnit.TestProject.ConstrainedGenericTestClass<>", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("GenericTypeResolverTests:global::TUnit.TestProject.ConstrainedGenericTestClass<>", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.ConstrainedGenericTestClass<>), - TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.ConstrainedGenericTestClass<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), - Name = "ConstrainedGenericTestClass", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("GenericTypeResolverTests", static () => new global::TUnit.Core.AssemblyMetadata { Name = "GenericTypeResolverTests" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.ConstrainedGenericTestClass<>), + TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.ConstrainedGenericTestClass<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), + Name = "ConstrainedGenericTestClass", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("GenericTypeResolverTests", "GenericTypeResolverTests"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => 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 b856bd2d9e..1ea4853f4d 100644 --- a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_GenericTestClass_WithExplicitInstantiation.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_GenericTestClass_WithExplicitInstantiation.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -39,20 +39,16 @@ internal sealed class TUnit_TestProject_GenericTestClass_T_TestMethod_TestSource ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("GenericTypeResolverTests:global::TUnit.TestProject.GenericTestClass<>", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("GenericTypeResolverTests:global::TUnit.TestProject.GenericTestClass<>", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.GenericTestClass<>), - TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.GenericTestClass<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), - Name = "GenericTestClass", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("GenericTypeResolverTests", static () => new global::TUnit.Core.AssemblyMetadata { Name = "GenericTypeResolverTests" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.GenericTestClass<>), + TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.GenericTestClass<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), + Name = "GenericTestClass", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("GenericTypeResolverTests", "GenericTypeResolverTests"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -97,20 +93,16 @@ internal sealed class TUnit_TestProject_GenericTestClass_T_TestMethod_TestSource ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("GenericTypeResolverTests:global::TUnit.TestProject.GenericTestClass<>", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("GenericTypeResolverTests:global::TUnit.TestProject.GenericTestClass<>", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.GenericTestClass<>), - TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.GenericTestClass<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), - Name = "GenericTestClass", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("GenericTypeResolverTests", static () => new global::TUnit.Core.AssemblyMetadata { Name = "GenericTypeResolverTests" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.GenericTestClass<>), + TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.GenericTestClass<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), + Name = "GenericTestClass", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("GenericTypeResolverTests", "GenericTypeResolverTests"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -161,20 +153,16 @@ internal sealed class TUnit_TestProject_GenericTestClass_T_TestMethod_TestSource ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("GenericTypeResolverTests:global::TUnit.TestProject.GenericTestClass<>", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("GenericTypeResolverTests:global::TUnit.TestProject.GenericTestClass<>", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.GenericTestClass<>), - TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.GenericTestClass<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), - Name = "GenericTestClass", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("GenericTypeResolverTests", static () => new global::TUnit.Core.AssemblyMetadata { Name = "GenericTypeResolverTests" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.GenericTestClass<>), + TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.GenericTestClass<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), + Name = "GenericTestClass", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("GenericTypeResolverTests", "GenericTypeResolverTests"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => 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 e292fd0ea7..bb71a25e93 100644 --- a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_GenericTestMethod_WithExplicitInstantiation.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_GenericTestMethod_WithExplicitInstantiation.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -39,20 +39,16 @@ internal sealed class TUnit_TestProject_TestClass_GenericTestMethod_TestSource : ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("GenericTypeResolverTests:global::TUnit.TestProject.TestClass", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("GenericTypeResolverTests:global::TUnit.TestProject.TestClass", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.TestClass), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TestClass)), - Name = "TestClass", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("GenericTypeResolverTests", static () => new global::TUnit.Core.AssemblyMetadata { Name = "GenericTypeResolverTests" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.TestClass), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TestClass)), + Name = "TestClass", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("GenericTypeResolverTests", "GenericTypeResolverTests"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -92,20 +88,16 @@ internal sealed class TUnit_TestProject_TestClass_GenericTestMethod_TestSource : ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("GenericTypeResolverTests:global::TUnit.TestProject.TestClass", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("GenericTypeResolverTests:global::TUnit.TestProject.TestClass", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.TestClass), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TestClass)), - Name = "TestClass", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("GenericTypeResolverTests", static () => new global::TUnit.Core.AssemblyMetadata { Name = "GenericTypeResolverTests" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.TestClass), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TestClass)), + Name = "TestClass", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("GenericTypeResolverTests", "GenericTypeResolverTests"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -157,20 +149,16 @@ internal sealed class TUnit_TestProject_TestClass_GenericTestMethod_TestSource : ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("GenericTypeResolverTests:global::TUnit.TestProject.TestClass", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("GenericTypeResolverTests:global::TUnit.TestProject.TestClass", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.TestClass), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TestClass)), - Name = "TestClass", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("GenericTypeResolverTests", static () => new global::TUnit.Core.AssemblyMetadata { Name = "GenericTypeResolverTests" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.TestClass), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TestClass)), + Name = "TestClass", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("GenericTypeResolverTests", "GenericTypeResolverTests"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => diff --git a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_MultipleGenericParameters.verified.txt b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_MultipleGenericParameters.verified.txt index fa3b79bed8..68e3a418db 100644 --- a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_MultipleGenericParameters.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_MultipleGenericParameters.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -39,20 +39,16 @@ internal sealed class TUnit_TestProject_MultiGenericTestClass_T1_T2_TestMethod_T ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("GenericTypeResolverTests:global::TUnit.TestProject.MultiGenericTestClass<,>", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("GenericTypeResolverTests:global::TUnit.TestProject.MultiGenericTestClass<,>", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MultiGenericTestClass<,>), - TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.MultiGenericTestClass<,>), [new global::TUnit.Core.GenericParameter(0, false, "T1"), new global::TUnit.Core.GenericParameter(1, false, "T2")]), - Name = "MultiGenericTestClass", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("GenericTypeResolverTests", static () => new global::TUnit.Core.AssemblyMetadata { Name = "GenericTypeResolverTests" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MultiGenericTestClass<,>), + TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.MultiGenericTestClass<,>), [new global::TUnit.Core.GenericParameter(0, false, "T1"), new global::TUnit.Core.GenericParameter(1, false, "T2")]), + Name = "MultiGenericTestClass", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("GenericTypeResolverTests", "GenericTypeResolverTests"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -97,20 +93,16 @@ internal sealed class TUnit_TestProject_MultiGenericTestClass_T1_T2_TestMethod_T ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("GenericTypeResolverTests:global::TUnit.TestProject.MultiGenericTestClass<,>", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("GenericTypeResolverTests:global::TUnit.TestProject.MultiGenericTestClass<,>", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MultiGenericTestClass<,>), - TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.MultiGenericTestClass<,>), [new global::TUnit.Core.GenericParameter(0, false, "T1"), new global::TUnit.Core.GenericParameter(1, false, "T2")]), - Name = "MultiGenericTestClass", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("GenericTypeResolverTests", static () => new global::TUnit.Core.AssemblyMetadata { Name = "GenericTypeResolverTests" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MultiGenericTestClass<,>), + TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.MultiGenericTestClass<,>), [new global::TUnit.Core.GenericParameter(0, false, "T1"), new global::TUnit.Core.GenericParameter(1, false, "T2")]), + Name = "MultiGenericTestClass", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("GenericTypeResolverTests", "GenericTypeResolverTests"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -161,20 +153,16 @@ internal sealed class TUnit_TestProject_MultiGenericTestClass_T1_T2_TestMethod_T ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("GenericTypeResolverTests:global::TUnit.TestProject.MultiGenericTestClass<,>", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("GenericTypeResolverTests:global::TUnit.TestProject.MultiGenericTestClass<,>", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MultiGenericTestClass<,>), - TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.MultiGenericTestClass<,>), [new global::TUnit.Core.GenericParameter(0, false, "T1"), new global::TUnit.Core.GenericParameter(1, false, "T2")]), - Name = "MultiGenericTestClass", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("GenericTypeResolverTests", static () => new global::TUnit.Core.AssemblyMetadata { Name = "GenericTypeResolverTests" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MultiGenericTestClass<,>), + TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.MultiGenericTestClass<,>), [new global::TUnit.Core.GenericParameter(0, false, "T1"), new global::TUnit.Core.GenericParameter(1, false, "T2")]), + Name = "MultiGenericTestClass", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("GenericTypeResolverTests", "GenericTypeResolverTests"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => diff --git a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_NestedGenericTypes.verified.txt b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_NestedGenericTypes.verified.txt index 7610fd5733..0f98951849 100644 --- a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_NestedGenericTypes.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_NestedGenericTypes.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -39,20 +39,16 @@ internal sealed class TUnit_TestProject_NestedGenericTestClass_T_TestMethod_Test ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("GenericTypeResolverTests:global::TUnit.TestProject.NestedGenericTestClass<>", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("GenericTypeResolverTests:global::TUnit.TestProject.NestedGenericTestClass<>", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.NestedGenericTestClass<>), - TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.NestedGenericTestClass<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), - Name = "NestedGenericTestClass", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("GenericTypeResolverTests", static () => new global::TUnit.Core.AssemblyMetadata { Name = "GenericTypeResolverTests" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.NestedGenericTestClass<>), + TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.NestedGenericTestClass<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), + Name = "NestedGenericTestClass", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("GenericTypeResolverTests", "GenericTypeResolverTests"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -97,20 +93,16 @@ internal sealed class TUnit_TestProject_NestedGenericTestClass_T_TestMethod_Test ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("GenericTypeResolverTests:global::TUnit.TestProject.NestedGenericTestClass<>", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("GenericTypeResolverTests:global::TUnit.TestProject.NestedGenericTestClass<>", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.NestedGenericTestClass<>), - TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.NestedGenericTestClass<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), - Name = "NestedGenericTestClass", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("GenericTypeResolverTests", static () => new global::TUnit.Core.AssemblyMetadata { Name = "GenericTypeResolverTests" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.NestedGenericTestClass<>), + TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.NestedGenericTestClass<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), + Name = "NestedGenericTestClass", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("GenericTypeResolverTests", "GenericTypeResolverTests"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -161,20 +153,16 @@ internal sealed class TUnit_TestProject_NestedGenericTestClass_T_TestMethod_Test ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("GenericTypeResolverTests:global::TUnit.TestProject.NestedGenericTestClass<>", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("GenericTypeResolverTests:global::TUnit.TestProject.NestedGenericTestClass<>", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.NestedGenericTestClass<>), - TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.NestedGenericTestClass<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), - Name = "NestedGenericTestClass", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("GenericTypeResolverTests", static () => new global::TUnit.Core.AssemblyMetadata { Name = "GenericTypeResolverTests" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.NestedGenericTestClass<>), + TypeInfo = new global::TUnit.Core.ConstructedGeneric(typeof(global::TUnit.TestProject.NestedGenericTestClass<>), [new global::TUnit.Core.GenericParameter(0, false, "T")]), + Name = "NestedGenericTestClass", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("GenericTypeResolverTests", "GenericTypeResolverTests"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => diff --git a/TUnit.Core.SourceGenerator.Tests/GlobalStaticAfterEachTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/GlobalStaticAfterEachTests.Test.verified.txt index b0fbb30e4d..d3e79b77f4 100644 --- a/TUnit.Core.SourceGenerator.Tests/GlobalStaticAfterEachTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/GlobalStaticAfterEachTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -35,20 +35,16 @@ internal static class TUnit_TestProject_AfterTests_GlobalBase1_AfterEach1_After_ ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.GlobalBase1", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.GlobalBase1", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AfterTests.GlobalBase1), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.GlobalBase1)), - Name = "GlobalBase1", - Namespace = "TUnit.TestProject.AfterTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AfterTests.GlobalBase1), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.GlobalBase1)), + Name = "GlobalBase1", + Namespace = "TUnit.TestProject.AfterTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -105,20 +101,16 @@ internal static class TUnit_TestProject_AfterTests_GlobalBase2_AfterEach2_After_ ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.GlobalBase2", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.GlobalBase2", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AfterTests.GlobalBase2), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.GlobalBase2)), - Name = "GlobalBase2", - Namespace = "TUnit.TestProject.AfterTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AfterTests.GlobalBase2), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.GlobalBase2)), + Name = "GlobalBase2", + Namespace = "TUnit.TestProject.AfterTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -175,20 +167,16 @@ internal static class TUnit_TestProject_AfterTests_GlobalBase3_AfterEach3_After_ ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.GlobalBase3", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.GlobalBase3", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AfterTests.GlobalBase3), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.GlobalBase3)), - Name = "GlobalBase3", - Namespace = "TUnit.TestProject.AfterTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AfterTests.GlobalBase3), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.GlobalBase3)), + Name = "GlobalBase3", + Namespace = "TUnit.TestProject.AfterTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -245,20 +233,16 @@ internal static class TUnit_TestProject_AfterTests_GlobalCleanUpTests_CleanUp_Af ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.GlobalCleanUpTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.GlobalCleanUpTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests)), - Name = "GlobalCleanUpTests", - Namespace = "TUnit.TestProject.AfterTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests)), + Name = "GlobalCleanUpTests", + Namespace = "TUnit.TestProject.AfterTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -324,20 +308,16 @@ internal static class TUnit_TestProject_AfterTests_GlobalCleanUpTests_CleanUp__C ReflectionInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests).GetMethod("CleanUp", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.GlobalCleanUpTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.GlobalCleanUpTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests)), - Name = "GlobalCleanUpTests", - Namespace = "TUnit.TestProject.AfterTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests)), + Name = "GlobalCleanUpTests", + Namespace = "TUnit.TestProject.AfterTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -403,20 +383,16 @@ internal static class TUnit_TestProject_AfterTests_GlobalCleanUpTests_CleanUpWit ReflectionInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests).GetMethod("CleanUpWithContext", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.Core.TestContext) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.GlobalCleanUpTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.GlobalCleanUpTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests)), - Name = "GlobalCleanUpTests", - Namespace = "TUnit.TestProject.AfterTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests)), + Name = "GlobalCleanUpTests", + Namespace = "TUnit.TestProject.AfterTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -489,20 +465,16 @@ internal static class TUnit_TestProject_AfterTests_GlobalCleanUpTests_CleanUpWit ReflectionInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests).GetMethod("CleanUpWithContext", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.GlobalCleanUpTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.GlobalCleanUpTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests)), - Name = "GlobalCleanUpTests", - Namespace = "TUnit.TestProject.AfterTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests)), + Name = "GlobalCleanUpTests", + Namespace = "TUnit.TestProject.AfterTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -566,20 +538,16 @@ internal static class TUnit_TestProject_AfterTests_GlobalBase1_AfterAll1__TestCo ReflectionInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalBase1).GetMethod("AfterAll1", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::TUnit.Core.TestContext) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.GlobalBase1", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.GlobalBase1", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AfterTests.GlobalBase1), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.GlobalBase1)), - Name = "GlobalBase1", - Namespace = "TUnit.TestProject.AfterTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AfterTests.GlobalBase1), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.GlobalBase1)), + Name = "GlobalBase1", + Namespace = "TUnit.TestProject.AfterTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -644,20 +612,16 @@ internal static class TUnit_TestProject_AfterTests_GlobalBase2_AfterAll2__TestCo ReflectionInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalBase2).GetMethod("AfterAll2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::TUnit.Core.TestContext) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.GlobalBase2", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.GlobalBase2", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AfterTests.GlobalBase2), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.GlobalBase2)), - Name = "GlobalBase2", - Namespace = "TUnit.TestProject.AfterTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AfterTests.GlobalBase2), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.GlobalBase2)), + Name = "GlobalBase2", + Namespace = "TUnit.TestProject.AfterTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -722,20 +686,16 @@ internal static class TUnit_TestProject_AfterTests_GlobalBase3_AfterAll3__TestCo ReflectionInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalBase3).GetMethod("AfterAll3", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::TUnit.Core.TestContext) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.GlobalBase3", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.GlobalBase3", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AfterTests.GlobalBase3), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.GlobalBase3)), - Name = "GlobalBase3", - Namespace = "TUnit.TestProject.AfterTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AfterTests.GlobalBase3), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.GlobalBase3)), + Name = "GlobalBase3", + Namespace = "TUnit.TestProject.AfterTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -800,20 +760,16 @@ internal static class TUnit_TestProject_AfterTests_GlobalCleanUpTests_AfterAllCl ReflectionInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests).GetMethod("AfterAllCleanUp", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::TUnit.Core.TestContext) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.GlobalCleanUpTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.GlobalCleanUpTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests)), - Name = "GlobalCleanUpTests", - Namespace = "TUnit.TestProject.AfterTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests)), + Name = "GlobalCleanUpTests", + Namespace = "TUnit.TestProject.AfterTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -885,20 +841,16 @@ internal static class TUnit_TestProject_AfterTests_GlobalCleanUpTests_AfterAllCl ReflectionInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests).GetMethod("AfterAllCleanUp", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.GlobalCleanUpTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.GlobalCleanUpTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests)), - Name = "GlobalCleanUpTests", - Namespace = "TUnit.TestProject.AfterTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests)), + Name = "GlobalCleanUpTests", + Namespace = "TUnit.TestProject.AfterTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -963,20 +915,16 @@ internal static class TUnit_TestProject_AfterTests_GlobalCleanUpTests_AfterAllCl ReflectionInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests).GetMethod("AfterAllCleanUpWithContext", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::TUnit.Core.TestContext) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.GlobalCleanUpTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.GlobalCleanUpTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests)), - Name = "GlobalCleanUpTests", - Namespace = "TUnit.TestProject.AfterTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests)), + Name = "GlobalCleanUpTests", + Namespace = "TUnit.TestProject.AfterTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -1048,20 +996,16 @@ internal static class TUnit_TestProject_AfterTests_GlobalCleanUpTests_AfterAllCl ReflectionInfo = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests).GetMethod("AfterAllCleanUpWithContext", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.GlobalCleanUpTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.GlobalCleanUpTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests)), - Name = "GlobalCleanUpTests", - Namespace = "TUnit.TestProject.AfterTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.GlobalCleanUpTests)), + Name = "GlobalCleanUpTests", + Namespace = "TUnit.TestProject.AfterTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, diff --git a/TUnit.Core.SourceGenerator.Tests/GlobalStaticBeforeEachTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/GlobalStaticBeforeEachTests.Test.verified.txt index c6cb59bb93..0223c74234 100644 --- a/TUnit.Core.SourceGenerator.Tests/GlobalStaticBeforeEachTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/GlobalStaticBeforeEachTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -35,20 +35,16 @@ internal static class TUnit_TestProject_BeforeTests_GlobalBase1_BeforeEach1_Befo ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.GlobalBase1", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.GlobalBase1", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.GlobalBase1), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.GlobalBase1)), - Name = "GlobalBase1", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.GlobalBase1), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.GlobalBase1)), + Name = "GlobalBase1", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -105,20 +101,16 @@ internal static class TUnit_TestProject_BeforeTests_GlobalBase2_BeforeEach2_Befo ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.GlobalBase2", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.GlobalBase2", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.GlobalBase2), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.GlobalBase2)), - Name = "GlobalBase2", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.GlobalBase2), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.GlobalBase2)), + Name = "GlobalBase2", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -175,20 +167,16 @@ internal static class TUnit_TestProject_BeforeTests_GlobalBase3_BeforeEach3_Befo ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.GlobalBase3", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.GlobalBase3", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.GlobalBase3), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.GlobalBase3)), - Name = "GlobalBase3", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.GlobalBase3), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.GlobalBase3)), + Name = "GlobalBase3", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -245,20 +233,16 @@ internal static class TUnit_TestProject_BeforeTests_GlobalSetUpTests_SetUp_Befor ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.GlobalSetUpTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.GlobalSetUpTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests)), - Name = "GlobalSetUpTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests)), + Name = "GlobalSetUpTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -324,20 +308,16 @@ internal static class TUnit_TestProject_BeforeTests_GlobalSetUpTests_SetUp__Canc ReflectionInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests).GetMethod("SetUp", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.GlobalSetUpTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.GlobalSetUpTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests)), - Name = "GlobalSetUpTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests)), + Name = "GlobalSetUpTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -403,20 +383,16 @@ internal static class TUnit_TestProject_BeforeTests_GlobalSetUpTests_SetUpWithCo ReflectionInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests).GetMethod("SetUpWithContext", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.Core.TestContext) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.GlobalSetUpTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.GlobalSetUpTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests)), - Name = "GlobalSetUpTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests)), + Name = "GlobalSetUpTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -489,20 +465,16 @@ internal static class TUnit_TestProject_BeforeTests_GlobalSetUpTests_SetUpWithCo ReflectionInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests).GetMethod("SetUpWithContext", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.GlobalSetUpTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.GlobalSetUpTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests)), - Name = "GlobalSetUpTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests)), + Name = "GlobalSetUpTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -566,20 +538,16 @@ internal static class TUnit_TestProject_BeforeTests_GlobalBase1_BeforeAll1__Test ReflectionInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalBase1).GetMethod("BeforeAll1", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::TUnit.Core.TestContext) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.GlobalBase1", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.GlobalBase1", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.GlobalBase1), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.GlobalBase1)), - Name = "GlobalBase1", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.GlobalBase1), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.GlobalBase1)), + Name = "GlobalBase1", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -644,20 +612,16 @@ internal static class TUnit_TestProject_BeforeTests_GlobalBase2_BeforeAll2__Test ReflectionInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalBase2).GetMethod("BeforeAll2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::TUnit.Core.TestContext) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.GlobalBase2", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.GlobalBase2", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.GlobalBase2), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.GlobalBase2)), - Name = "GlobalBase2", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.GlobalBase2), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.GlobalBase2)), + Name = "GlobalBase2", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -722,20 +686,16 @@ internal static class TUnit_TestProject_BeforeTests_GlobalBase3_BeforeAll3__Test ReflectionInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalBase3).GetMethod("BeforeAll3", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::TUnit.Core.TestContext) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.GlobalBase3", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.GlobalBase3", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.GlobalBase3), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.GlobalBase3)), - Name = "GlobalBase3", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.GlobalBase3), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.GlobalBase3)), + Name = "GlobalBase3", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -800,20 +760,16 @@ internal static class TUnit_TestProject_BeforeTests_GlobalSetUpTests_BeforeAllSe ReflectionInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests).GetMethod("BeforeAllSetUp", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::TUnit.Core.TestContext) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.GlobalSetUpTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.GlobalSetUpTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests)), - Name = "GlobalSetUpTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests)), + Name = "GlobalSetUpTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -885,20 +841,16 @@ internal static class TUnit_TestProject_BeforeTests_GlobalSetUpTests_BeforeAllSe ReflectionInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests).GetMethod("BeforeAllSetUp", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.GlobalSetUpTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.GlobalSetUpTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests)), - Name = "GlobalSetUpTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests)), + Name = "GlobalSetUpTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -963,20 +915,16 @@ internal static class TUnit_TestProject_BeforeTests_GlobalSetUpTests_BeforeAllSe ReflectionInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests).GetMethod("BeforeAllSetUpWithContext", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::TUnit.Core.TestContext) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.GlobalSetUpTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.GlobalSetUpTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests)), - Name = "GlobalSetUpTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests)), + Name = "GlobalSetUpTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -1048,20 +996,16 @@ internal static class TUnit_TestProject_BeforeTests_GlobalSetUpTests_BeforeAllSe ReflectionInfo = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests).GetMethod("BeforeAllSetUpWithContext", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::TUnit.Core.TestContext), typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.GlobalSetUpTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.GlobalSetUpTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests)), - Name = "GlobalSetUpTests", - Namespace = "TUnit.TestProject.BeforeTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.GlobalSetUpTests)), + Name = "GlobalSetUpTests", + Namespace = "TUnit.TestProject.BeforeTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, diff --git a/TUnit.Core.SourceGenerator.Tests/Hooks1589.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Hooks1589.Test.verified.txt index 0da7af9a9e..d4649937f3 100644 --- a/TUnit.Core.SourceGenerator.Tests/Hooks1589.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Hooks1589.Test.verified.txt @@ -15,13 +15,7 @@ internal sealed class TUnit_TestProject_Bugs__1589_MyTests_Test1_TestSource : gl TestClassType = typeof(global::TUnit.TestProject.Bugs._1589.MyTests), TestMethodName = "Test1", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.ClassDataSourceAttribute() -{Shared = global::TUnit.Core.SharedType.None,} - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] { @@ -42,46 +36,29 @@ internal sealed class TUnit_TestProject_Bugs__1589_MyTests_Test1_TestSource : gl ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1589.MyTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1589.MyTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata + Type = typeof(global::TUnit.TestProject.Bugs._1589.MyTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1589.MyTests)), + Name = "MyTests", + Namespace = "TUnit.TestProject.Bugs._1589", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = new global::TUnit.Core.ParameterMetadata[] { - Type = typeof(global::TUnit.TestProject.Bugs._1589.MyTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1589.MyTests)), - Name = "MyTests", - Namespace = "TUnit.TestProject.Bugs._1589", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = new global::TUnit.Core.ParameterMetadata[] + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Bugs._1589.MyFixture)) { - new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Bugs._1589.MyFixture)) - { - Name = "myFixture", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1589.MyFixture)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1589.MyTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.Bugs._1589.MyFixture) })!.GetParameters()[0] - } - }, - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Name = "myFixture", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1589.MyFixture)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1589.MyTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.Bugs._1589.MyFixture) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.Bugs._1589.MyTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.Test1()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -104,6 +81,31 @@ internal sealed class TUnit_TestProject_Bugs__1589_MyTests_Test1_TestSource : gl Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.ClassDataSourceAttribute() +{Shared = global::TUnit.Core.SharedType.None,} + ]; + } + private static global::TUnit.TestProject.Bugs._1589.MyTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._1589.MyTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1589.MyTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.Test1()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__1589_MyTests_Test1_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/Hooks1594.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Hooks1594.Test.verified.txt index e1f3db50a7..5a987b317f 100644 --- a/TUnit.Core.SourceGenerator.Tests/Hooks1594.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Hooks1594.Test.verified.txt @@ -15,13 +15,7 @@ internal sealed class TUnit_TestProject_Bugs__1594_MyTests_Test1_TestSource : gl TestClassType = typeof(global::TUnit.TestProject.Bugs._1594.MyTests), TestMethodName = "Test1", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.ClassDataSourceAttribute() -{Shared = global::TUnit.Core.SharedType.None,} - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] { @@ -42,47 +36,29 @@ internal sealed class TUnit_TestProject_Bugs__1594_MyTests_Test1_TestSource : gl ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1594.MyTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1594.MyTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata + Type = typeof(global::TUnit.TestProject.Bugs._1594.MyTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1594.MyTests)), + Name = "MyTests", + Namespace = "TUnit.TestProject.Bugs._1594", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = new global::TUnit.Core.ParameterMetadata[] { - Type = typeof(global::TUnit.TestProject.Bugs._1594.MyTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1594.MyTests)), - Name = "MyTests", - Namespace = "TUnit.TestProject.Bugs._1594", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = new global::TUnit.Core.ParameterMetadata[] + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Bugs._1594.MyFixture)) { - new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Bugs._1594.MyFixture)) - { - Name = "myFixture", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1594.MyFixture)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1594.MyTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.Bugs._1594.MyFixture) })!.GetParameters()[0] - } - }, - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Name = "myFixture", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1594.MyFixture)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1594.MyTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.Bugs._1594.MyFixture) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.Bugs._1594.MyTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.Test1(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -105,6 +81,32 @@ internal sealed class TUnit_TestProject_Bugs__1594_MyTests_Test1_TestSource : gl Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.ClassDataSourceAttribute() +{Shared = global::TUnit.Core.SharedType.None,} + ]; + } + private static global::TUnit.TestProject.Bugs._1594.MyTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._1594.MyTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1594.MyTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.Test1(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__1594_MyTests_Test1_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/HooksTests.DisposableFieldTests.verified.txt b/TUnit.Core.SourceGenerator.Tests/HooksTests.DisposableFieldTests.verified.txt index 9c01770e19..6673e1a046 100644 --- a/TUnit.Core.SourceGenerator.Tests/HooksTests.DisposableFieldTests.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/HooksTests.DisposableFieldTests.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -35,20 +35,16 @@ internal static class TUnit_TestProject_DisposableFieldTests_Setup_Before_TestIn ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DisposableFieldTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DisposableFieldTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DisposableFieldTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DisposableFieldTests)), - Name = "DisposableFieldTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DisposableFieldTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DisposableFieldTests)), + Name = "DisposableFieldTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, @@ -105,20 +101,16 @@ internal static class TUnit_TestProject_DisposableFieldTests_Blah_After_TestInit ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DisposableFieldTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DisposableFieldTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.DisposableFieldTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DisposableFieldTests)), - Name = "DisposableFieldTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.DisposableFieldTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DisposableFieldTests)), + Name = "DisposableFieldTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, HookExecutor = DefaultExecutor.Instance, diff --git a/TUnit.Core.SourceGenerator.Tests/InheritedPropertySetterTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/InheritedPropertySetterTests.Test.verified.txt index 123acfb153..4018692264 100644 --- a/TUnit.Core.SourceGenerator.Tests/InheritedPropertySetterTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/InheritedPropertySetterTests.Test.verified.txt @@ -29,12 +29,7 @@ internal sealed class TUnit_TestProject_PropertySetterTests_Test_TestSource : gl TestClassType = typeof(global::TUnit.TestProject.PropertySetterTests), TestMethodName = "Test", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.NotInParallelAttribute("PropertySetterTests") - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = new global::TUnit.Core.PropertyDataSource[] @@ -201,138 +196,110 @@ internal sealed class TUnit_TestProject_PropertySetterTests_Test_TestSource : gl ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.PropertySetterTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.PropertySetterTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata + Type = typeof(global::TUnit.TestProject.PropertySetterTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.PropertySetterTests)), + Name = "PropertySetterTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = new global::TUnit.Core.PropertyMetadata[] { - Type = typeof(global::TUnit.TestProject.PropertySetterTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.PropertySetterTests)), - Name = "PropertySetterTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = new global::TUnit.Core.PropertyMetadata[] + new global::TUnit.Core.PropertyMetadata { - new global::TUnit.Core.PropertyMetadata - { - ReflectionInfo = typeof(global::TUnit.TestProject.PropertySetterTests).GetProperty("Property1"), - Type = typeof(string), - Name = "Property1", - IsStatic = false, - IsNullable = false, - Getter = o => ((global::TUnit.TestProject.PropertySetterTests)o).Property1, - ClassMetadata = null!, - ContainingTypeMetadata = null! - }, - new global::TUnit.Core.PropertyMetadata - { - ReflectionInfo = typeof(global::TUnit.TestProject.PropertySetterTests).GetProperty("Property2"), - Type = typeof(string), - Name = "Property2", - IsStatic = false, - IsNullable = false, - Getter = o => ((global::TUnit.TestProject.PropertySetterTests)o).Property2, - ClassMetadata = null!, - ContainingTypeMetadata = null! - }, - new global::TUnit.Core.PropertyMetadata - { - ReflectionInfo = typeof(global::TUnit.TestProject.PropertySetterTests).GetProperty("Property3"), - Type = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - Name = "Property3", - IsStatic = false, - IsNullable = false, - Getter = o => ((global::TUnit.TestProject.PropertySetterTests)o).Property3, - ClassMetadata = null!, - ContainingTypeMetadata = null! - }, - new global::TUnit.Core.PropertyMetadata - { - ReflectionInfo = typeof(global::TUnit.TestProject.PropertySetterTests).GetProperty("Property4"), - Type = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - Name = "Property4", - IsStatic = false, - IsNullable = false, - Getter = o => ((global::TUnit.TestProject.PropertySetterTests)o).Property4, - ClassMetadata = null!, - ContainingTypeMetadata = null! - }, - new global::TUnit.Core.PropertyMetadata - { - ReflectionInfo = typeof(global::TUnit.TestProject.PropertySetterTests).GetProperty("Property5"), - Type = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - Name = "Property5", - IsStatic = false, - IsNullable = false, - Getter = o => ((global::TUnit.TestProject.PropertySetterTests)o).Property5, - ClassMetadata = null!, - ContainingTypeMetadata = null! - }, - new global::TUnit.Core.PropertyMetadata - { - ReflectionInfo = typeof(global::TUnit.TestProject.PropertySetterTests).GetProperty("Property6"), - Type = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - Name = "Property6", - IsStatic = false, - IsNullable = false, - Getter = o => ((global::TUnit.TestProject.PropertySetterTests)o).Property6, - ClassMetadata = null!, - ContainingTypeMetadata = null! - }, - new global::TUnit.Core.PropertyMetadata - { - ReflectionInfo = typeof(global::TUnit.TestProject.PropertySetterTests).GetProperty("Property7"), - Type = typeof(string), - Name = "Property7", - IsStatic = false, - IsNullable = false, - Getter = o => ((global::TUnit.TestProject.PropertySetterTests)o).Property7, - ClassMetadata = null!, - ContainingTypeMetadata = null! - }, - new global::TUnit.Core.PropertyMetadata - { - ReflectionInfo = typeof(global::TUnit.TestProject.PropertySetterTests).GetProperty("StaticProperty"), - Type = typeof(global::TUnit.TestProject.PropertySetterTests.StaticInnerModel), - Name = "StaticProperty", - IsStatic = true, - IsNullable = false, - Getter = _ => global::TUnit.TestProject.PropertySetterTests.StaticProperty, - ClassMetadata = null!, - ContainingTypeMetadata = null! - } + ReflectionInfo = typeof(global::TUnit.TestProject.PropertySetterTests).GetProperty("Property1"), + Type = typeof(string), + Name = "Property1", + IsStatic = false, + IsNullable = false, + Getter = o => ((global::TUnit.TestProject.PropertySetterTests)o).Property1, + ClassMetadata = null!, + ContainingTypeMetadata = null! }, - Parent = null - }; - foreach (var prop in classMetadata.Properties) - { - prop.ClassMetadata = classMetadata; - prop.ContainingTypeMetadata = classMetadata; - } - return classMetadata; + new global::TUnit.Core.PropertyMetadata + { + ReflectionInfo = typeof(global::TUnit.TestProject.PropertySetterTests).GetProperty("Property2"), + Type = typeof(string), + Name = "Property2", + IsStatic = false, + IsNullable = false, + Getter = o => ((global::TUnit.TestProject.PropertySetterTests)o).Property2, + ClassMetadata = null!, + ContainingTypeMetadata = null! + }, + new global::TUnit.Core.PropertyMetadata + { + ReflectionInfo = typeof(global::TUnit.TestProject.PropertySetterTests).GetProperty("Property3"), + Type = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), + Name = "Property3", + IsStatic = false, + IsNullable = false, + Getter = o => ((global::TUnit.TestProject.PropertySetterTests)o).Property3, + ClassMetadata = null!, + ContainingTypeMetadata = null! + }, + new global::TUnit.Core.PropertyMetadata + { + ReflectionInfo = typeof(global::TUnit.TestProject.PropertySetterTests).GetProperty("Property4"), + Type = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), + Name = "Property4", + IsStatic = false, + IsNullable = false, + Getter = o => ((global::TUnit.TestProject.PropertySetterTests)o).Property4, + ClassMetadata = null!, + ContainingTypeMetadata = null! + }, + new global::TUnit.Core.PropertyMetadata + { + ReflectionInfo = typeof(global::TUnit.TestProject.PropertySetterTests).GetProperty("Property5"), + Type = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), + Name = "Property5", + IsStatic = false, + IsNullable = false, + Getter = o => ((global::TUnit.TestProject.PropertySetterTests)o).Property5, + ClassMetadata = null!, + ContainingTypeMetadata = null! + }, + new global::TUnit.Core.PropertyMetadata + { + ReflectionInfo = typeof(global::TUnit.TestProject.PropertySetterTests).GetProperty("Property6"), + Type = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), + Name = "Property6", + IsStatic = false, + IsNullable = false, + Getter = o => ((global::TUnit.TestProject.PropertySetterTests)o).Property6, + ClassMetadata = null!, + ContainingTypeMetadata = null! + }, + new global::TUnit.Core.PropertyMetadata + { + ReflectionInfo = typeof(global::TUnit.TestProject.PropertySetterTests).GetProperty("Property7"), + Type = typeof(string), + Name = "Property7", + IsStatic = false, + IsNullable = false, + Getter = o => ((global::TUnit.TestProject.PropertySetterTests)o).Property7, + ClassMetadata = null!, + ContainingTypeMetadata = null! + }, + new global::TUnit.Core.PropertyMetadata + { + ReflectionInfo = typeof(global::TUnit.TestProject.PropertySetterTests).GetProperty("StaticProperty"), + Type = typeof(global::TUnit.TestProject.PropertySetterTests.StaticInnerModel), + Name = "StaticProperty", + IsStatic = true, + IsNullable = false, + Getter = _ => global::TUnit.TestProject.PropertySetterTests.StaticProperty, + ClassMetadata = null!, + ContainingTypeMetadata = null! + } + }, + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.PropertySetterTests() - { - Property1 = default!, - Property2 = default!, - Property3 = default!, - Property4 = default!, - Property5 = default!, - Property6 = default!, - Property7 = default!, - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.Test()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -355,6 +322,39 @@ internal sealed class TUnit_TestProject_PropertySetterTests_Test_TestSource : gl Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.NotInParallelAttribute("PropertySetterTests") + ]; + } + private static global::TUnit.TestProject.PropertySetterTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.PropertySetterTests() + { + Property1 = default!, + Property2 = default!, + Property3 = default!, + Property4 = default!, + Property5 = default!, + Property6 = default!, + Property7 = default!, + }; + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.PropertySetterTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.Test()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_PropertySetterTests_Test_ModuleInitializer { @@ -399,13 +399,7 @@ internal sealed class TUnit_TestProject_InheritedPropertySetterTests_Test_TestSo TestClassType = typeof(global::TUnit.TestProject.InheritedPropertySetterTests), TestMethodName = "Test", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.InheritsTestsAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.NotInParallelAttribute("PropertySetterTests") - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = new global::TUnit.Core.PropertyDataSource[] @@ -561,43 +555,20 @@ internal sealed class TUnit_TestProject_InheritedPropertySetterTests_Test_TestSo ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.InheritedPropertySetterTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.InheritedPropertySetterTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.InheritedPropertySetterTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.InheritedPropertySetterTests)), - Name = "InheritedPropertySetterTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.InheritedPropertySetterTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.InheritedPropertySetterTests)), + Name = "InheritedPropertySetterTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.InheritedPropertySetterTests() - { - Property1 = default!, - Property2 = default!, - Property3 = default!, - Property4 = default!, - Property5 = default!, - Property6 = default!, - Property7 = default!, - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.Test()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -620,6 +591,40 @@ internal sealed class TUnit_TestProject_InheritedPropertySetterTests_Test_TestSo Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.InheritsTestsAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.NotInParallelAttribute("PropertySetterTests") + ]; + } + private static global::TUnit.TestProject.InheritedPropertySetterTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.InheritedPropertySetterTests() + { + Property1 = default!, + Property2 = default!, + Property3 = default!, + Property4 = default!, + Property5 = default!, + Property6 = default!, + Property7 = default!, + }; + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.InheritedPropertySetterTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.Test()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_InheritedPropertySetterTests_Test_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/InheritedTestsFromDifferentProjectTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/InheritedTestsFromDifferentProjectTests.Test.verified.txt index 58855ad1ce..d93937fb6e 100644 --- a/TUnit.Core.SourceGenerator.Tests/InheritedTestsFromDifferentProjectTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/InheritedTestsFromDifferentProjectTests.Test.verified.txt @@ -15,13 +15,7 @@ internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ TestClassType = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), TestMethodName = "Test", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(Pass), - new global::TUnit.Core.InheritsTestsAttribute(), - new global::TUnit.Core.CategoryAttribute("BaseCategoriesOnClass") - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -38,35 +32,20 @@ internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests)), - Name = "InheritedTestsFromDifferentProjectTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests)), + Name = "InheritedTestsFromDifferentProjectTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.Test(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -89,6 +68,32 @@ internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(Pass), + new global::TUnit.Core.InheritsTestsAttribute(), + new global::TUnit.Core.CategoryAttribute("BaseCategoriesOnClass") + ]; + } + private static global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.Test(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_Test_ModuleInitializer { @@ -119,13 +124,7 @@ internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ TestClassType = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), TestMethodName = "GenericMethodDataSource", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(Pass), - new global::TUnit.Core.InheritsTestsAttribute(), - new global::TUnit.Core.CategoryAttribute("BaseCategoriesOnClass") - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("Foo"), @@ -154,43 +153,20 @@ internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ ReflectionInfo = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests).GetMethod("GenericMethodDataSource", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests)), - Name = "InheritedTestsFromDifferentProjectTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests)), + Name = "InheritedTestsFromDifferentProjectTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.GenericMethodDataSource(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -213,6 +189,40 @@ internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(Pass), + new global::TUnit.Core.InheritsTestsAttribute(), + new global::TUnit.Core.CategoryAttribute("BaseCategoriesOnClass") + ]; + } + private static global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.GenericMethodDataSource(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_GenericMethodDataSource__string_ModuleInitializer { @@ -243,13 +253,7 @@ internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ TestClassType = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), TestMethodName = "NonGenericMethodDataSource", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(Pass), - new global::TUnit.Core.InheritsTestsAttribute(), - new global::TUnit.Core.CategoryAttribute("BaseCategoriesOnClass") - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.TestData), "Foo") @@ -289,43 +293,20 @@ internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ ReflectionInfo = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests).GetMethod("NonGenericMethodDataSource", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests)), - Name = "InheritedTestsFromDifferentProjectTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests)), + Name = "InheritedTestsFromDifferentProjectTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.NonGenericMethodDataSource(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -348,6 +329,40 @@ internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(Pass), + new global::TUnit.Core.InheritsTestsAttribute(), + new global::TUnit.Core.CategoryAttribute("BaseCategoriesOnClass") + ]; + } + private static global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.NonGenericMethodDataSource(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_NonGenericMethodDataSource__string_ModuleInitializer { @@ -378,13 +393,7 @@ internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ TestClassType = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), TestMethodName = "VerifyInheritedCategoriesAreAvailable", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(Pass), - new global::TUnit.Core.InheritsTestsAttribute(), - new global::TUnit.Core.CategoryAttribute("BaseCategoriesOnClass") - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -401,34 +410,20 @@ internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests)), - Name = "InheritedTestsFromDifferentProjectTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests)), + Name = "InheritedTestsFromDifferentProjectTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.VerifyInheritedCategoriesAreAvailable()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -451,6 +446,31 @@ internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(Pass), + new global::TUnit.Core.InheritsTestsAttribute(), + new global::TUnit.Core.CategoryAttribute("BaseCategoriesOnClass") + ]; + } + private static global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.VerifyInheritedCategoriesAreAvailable()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_VerifyInheritedCategoriesAreAvailable_ModuleInitializer { @@ -481,14 +501,7 @@ internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ TestClassType = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), TestMethodName = "BaseTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.CategoryAttribute("BaseCategory"), - new global::TUnit.TestProject.Attributes.EngineTest(Pass), - new global::TUnit.Core.InheritsTestsAttribute(), - new global::TUnit.Core.CategoryAttribute("BaseCategoriesOnClass") - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -505,35 +518,20 @@ internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests)), - Name = "InheritedTestsFromDifferentProjectTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests)), + Name = "InheritedTestsFromDifferentProjectTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.BaseTest(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -556,6 +554,33 @@ internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.CategoryAttribute("BaseCategory"), + new global::TUnit.TestProject.Attributes.EngineTest(Pass), + new global::TUnit.Core.InheritsTestsAttribute(), + new global::TUnit.Core.CategoryAttribute("BaseCategoriesOnClass") + ]; + } + private static global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.BaseTest(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_BaseTest_ModuleInitializer { @@ -586,15 +611,7 @@ internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ TestClassType = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), TestMethodName = "BaseTestWithMultipleCategories", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.CategoryAttribute("AnotherBaseCategory"), - new global::TUnit.Core.CategoryAttribute("MultipleCategories"), - new global::TUnit.TestProject.Attributes.EngineTest(Pass), - new global::TUnit.Core.InheritsTestsAttribute(), - new global::TUnit.Core.CategoryAttribute("BaseCategoriesOnClass") - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -611,35 +628,20 @@ internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests)), - Name = "InheritedTestsFromDifferentProjectTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests)), + Name = "InheritedTestsFromDifferentProjectTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.BaseTestWithMultipleCategories(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -662,6 +664,34 @@ internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.CategoryAttribute("AnotherBaseCategory"), + new global::TUnit.Core.CategoryAttribute("MultipleCategories"), + new global::TUnit.TestProject.Attributes.EngineTest(Pass), + new global::TUnit.Core.InheritsTestsAttribute(), + new global::TUnit.Core.CategoryAttribute("BaseCategoriesOnClass") + ]; + } + private static global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.BaseTestWithMultipleCategories(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_BaseTestWithMultipleCategories_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/InheritsTestsAbstractTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/InheritsTestsAbstractTests.Test.verified.txt index 8aac896da7..925070d2e5 100644 --- a/TUnit.Core.SourceGenerator.Tests/InheritsTestsAbstractTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/InheritsTestsAbstractTests.Test.verified.txt @@ -15,12 +15,7 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_ TestClassType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), TestMethodName = "SecondTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.InheritsTestsAttribute(), - new global::TUnit.Core.InheritsTestsAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -37,35 +32,20 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_ ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AbstractTests.ConcreteClass2", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AbstractTests.ConcreteClass2", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2)), - Name = "ConcreteClass2", - Namespace = "TUnit.TestProject.AbstractTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2)), + Name = "ConcreteClass2", + Namespace = "TUnit.TestProject.AbstractTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.AbstractTests.ConcreteClass2(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.SecondTest(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -88,6 +68,31 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_ Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.InheritsTestsAttribute(), + new global::TUnit.Core.InheritsTestsAttribute() + ]; + } + private static global::TUnit.TestProject.AbstractTests.ConcreteClass2 __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.AbstractTests.ConcreteClass2(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AbstractTests.ConcreteClass2 instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.SecondTest(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_ModuleInitializer { @@ -118,12 +123,7 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_AssertClass TestClassType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), TestMethodName = "AssertClassName", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.InheritsTestsAttribute(), - new global::TUnit.Core.InheritsTestsAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -140,34 +140,20 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_AssertClass ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AbstractTests.ConcreteClass2", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AbstractTests.ConcreteClass2", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2)), - Name = "ConcreteClass2", - Namespace = "TUnit.TestProject.AbstractTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2)), + Name = "ConcreteClass2", + Namespace = "TUnit.TestProject.AbstractTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.AbstractTests.ConcreteClass2(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.AssertClassName()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -190,6 +176,30 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_AssertClass Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.InheritsTestsAttribute(), + new global::TUnit.Core.InheritsTestsAttribute() + ]; + } + private static global::TUnit.TestProject.AbstractTests.ConcreteClass2 __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.AbstractTests.ConcreteClass2(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AbstractTests.ConcreteClass2 instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.AssertClassName()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_AbstractTests_ConcreteClass2_AssertClassName_ModuleInitializer { @@ -220,11 +230,7 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClass TestClassType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1), TestMethodName = "AssertClassName", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.InheritsTestsAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -241,34 +247,20 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClass ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AbstractTests.ConcreteClass1", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AbstractTests.ConcreteClass1", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1)), - Name = "ConcreteClass1", - Namespace = "TUnit.TestProject.AbstractTests", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1)), + Name = "ConcreteClass1", + Namespace = "TUnit.TestProject.AbstractTests", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.AbstractTests.ConcreteClass1(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.AssertClassName()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -291,6 +283,29 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClass Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.InheritsTestsAttribute() + ]; + } + private static global::TUnit.TestProject.AbstractTests.ConcreteClass1 __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.AbstractTests.ConcreteClass1(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AbstractTests.ConcreteClass1 instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.AssertClassName()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClassName_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/InheritsTestsTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/InheritsTestsTests.Test.verified.txt index 9602a729d1..3f4bea97cb 100644 --- a/TUnit.Core.SourceGenerator.Tests/InheritsTestsTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/InheritsTestsTests.Test.verified.txt @@ -19,12 +19,7 @@ internal sealed class TUnit_TestProject_Bugs__1924_None_BaseClass_Test__int_Test TestClassType = typeof(global::TUnit.TestProject.Bugs._1924.None.BaseClass), TestMethodName = "Test", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.RepeatAttribute(10), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, RepeatCount = 10, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { @@ -82,63 +77,33 @@ internal sealed class TUnit_TestProject_Bugs__1924_None_BaseClass_Test__int_Test ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1924.None.BaseClass).GetMethod("Test", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1924.None.BaseClass", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1924.None.BaseClass", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata + Type = typeof(global::TUnit.TestProject.Bugs._1924.None.BaseClass), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1924.None.BaseClass)), + Name = "BaseClass", + Namespace = "TUnit.TestProject.Bugs._1924.None", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = new global::TUnit.Core.PropertyMetadata[] { - Type = typeof(global::TUnit.TestProject.Bugs._1924.None.BaseClass), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1924.None.BaseClass)), - Name = "BaseClass", - Namespace = "TUnit.TestProject.Bugs._1924.None", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = new global::TUnit.Core.PropertyMetadata[] + new global::TUnit.Core.PropertyMetadata { - new global::TUnit.Core.PropertyMetadata - { - ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1924.None.BaseClass).GetProperty("Data"), - Type = typeof(global::TUnit.TestProject.Bugs._1924.DataClass), - Name = "Data", - IsStatic = false, - IsNullable = false, - Getter = o => ((global::TUnit.TestProject.Bugs._1924.None.BaseClass)o).Data, - ClassMetadata = null!, - ContainingTypeMetadata = null! - } - }, - Parent = null - }; - foreach (var prop in classMetadata.Properties) - { - prop.ClassMetadata = classMetadata; - prop.ContainingTypeMetadata = classMetadata; - } - return classMetadata; + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1924.None.BaseClass).GetProperty("Data"), + Type = typeof(global::TUnit.TestProject.Bugs._1924.DataClass), + Name = "Data", + IsStatic = false, + IsNullable = false, + Getter = o => ((global::TUnit.TestProject.Bugs._1924.None.BaseClass)o).Data, + ClassMetadata = null!, + ContainingTypeMetadata = null! + } + }, + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.Bugs._1924.None.BaseClass() - { - Data = default!, - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Test(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -161,6 +126,41 @@ internal sealed class TUnit_TestProject_Bugs__1924_None_BaseClass_Test__int_Test Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.RepeatAttribute(10), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.Bugs._1924.None.BaseClass __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._1924.None.BaseClass() + { + Data = default!, + }; + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1924.None.BaseClass instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.Test(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__1924_None_BaseClass_Test__int_ModuleInitializer { @@ -195,13 +195,7 @@ internal sealed class TUnit_TestProject_Bugs__1924_None_Tests_Test__int_TestSour TestClassType = typeof(global::TUnit.TestProject.Bugs._1924.None.Tests), TestMethodName = "Test", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.RepeatAttribute(10), - new global::TUnit.Core.InheritsTestsAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, RepeatCount = 10, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { @@ -259,45 +253,20 @@ internal sealed class TUnit_TestProject_Bugs__1924_None_Tests_Test__int_TestSour ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1924.None.BaseClass).GetMethod("Test", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1924.None.Tests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1924.None.Tests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._1924.None.Tests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1924.None.Tests)), - Name = "Tests", - Namespace = "TUnit.TestProject.Bugs._1924.None", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._1924.None.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1924.None.Tests)), + Name = "Tests", + Namespace = "TUnit.TestProject.Bugs._1924.None", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.Bugs._1924.None.Tests() - { - Data = default!, - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Test(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -320,6 +289,42 @@ internal sealed class TUnit_TestProject_Bugs__1924_None_Tests_Test__int_TestSour Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.RepeatAttribute(10), + new global::TUnit.Core.InheritsTestsAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.Bugs._1924.None.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._1924.None.Tests() + { + Data = default!, + }; + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1924.None.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.Test(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__1924_None_Tests_Test__int_ModuleInitializer { @@ -354,13 +359,7 @@ internal sealed class TUnit_TestProject_Bugs__1924_None_Tests2_Test__int_TestSou TestClassType = typeof(global::TUnit.TestProject.Bugs._1924.None.Tests2), TestMethodName = "Test", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.RepeatAttribute(10), - new global::TUnit.Core.InheritsTestsAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, RepeatCount = 10, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { @@ -418,45 +417,20 @@ internal sealed class TUnit_TestProject_Bugs__1924_None_Tests2_Test__int_TestSou ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1924.None.BaseClass).GetMethod("Test", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1924.None.Tests2", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1924.None.Tests2", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._1924.None.Tests2), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1924.None.Tests2)), - Name = "Tests2", - Namespace = "TUnit.TestProject.Bugs._1924.None", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._1924.None.Tests2), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1924.None.Tests2)), + Name = "Tests2", + Namespace = "TUnit.TestProject.Bugs._1924.None", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.Bugs._1924.None.Tests2() - { - Data = default!, - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Test(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -479,6 +453,42 @@ internal sealed class TUnit_TestProject_Bugs__1924_None_Tests2_Test__int_TestSou Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.RepeatAttribute(10), + new global::TUnit.Core.InheritsTestsAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.Bugs._1924.None.Tests2 __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._1924.None.Tests2() + { + Data = default!, + }; + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1924.None.Tests2 instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.Test(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__1924_None_Tests2_Test__int_ModuleInitializer { @@ -513,13 +523,7 @@ internal sealed class TUnit_TestProject_Bugs__1924_None_Tests3_Test__int_TestSou TestClassType = typeof(global::TUnit.TestProject.Bugs._1924.None.Tests3), TestMethodName = "Test", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.RepeatAttribute(10), - new global::TUnit.Core.InheritsTestsAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, RepeatCount = 10, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { @@ -577,45 +581,20 @@ internal sealed class TUnit_TestProject_Bugs__1924_None_Tests3_Test__int_TestSou ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1924.None.BaseClass).GetMethod("Test", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1924.None.Tests3", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1924.None.Tests3", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._1924.None.Tests3), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1924.None.Tests3)), - Name = "Tests3", - Namespace = "TUnit.TestProject.Bugs._1924.None", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._1924.None.Tests3), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1924.None.Tests3)), + Name = "Tests3", + Namespace = "TUnit.TestProject.Bugs._1924.None", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.Bugs._1924.None.Tests3() - { - Data = default!, - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Test(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -638,6 +617,42 @@ internal sealed class TUnit_TestProject_Bugs__1924_None_Tests3_Test__int_TestSou Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.RepeatAttribute(10), + new global::TUnit.Core.InheritsTestsAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.Bugs._1924.None.Tests3 __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._1924.None.Tests3() + { + Data = default!, + }; + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1924.None.Tests3 instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.Test(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__1924_None_Tests3_Test__int_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/Issue2887Tests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Issue2887Tests.Test.verified.txt index 1c1063e143..84bcebdc4f 100644 --- a/TUnit.Core.SourceGenerator.Tests/Issue2887Tests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Issue2887Tests.Test.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_Bugs__Issue2887_ActualTestClass_Test1_Te TestClassType = typeof(global::TUnit.TestProject.Bugs._Issue2887.ActualTestClass), TestMethodName = "Test1", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.ClassConstructorAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -36,48 +32,29 @@ internal sealed class TUnit_TestProject_Bugs__Issue2887_ActualTestClass_Test1_Te ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._Issue2887.ActualTestClass", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._Issue2887.ActualTestClass", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata + Type = typeof(global::TUnit.TestProject.Bugs._Issue2887.ActualTestClass), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._Issue2887.ActualTestClass)), + Name = "ActualTestClass", + Namespace = "TUnit.TestProject.Bugs._Issue2887", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = new global::TUnit.Core.ParameterMetadata[] { - Type = typeof(global::TUnit.TestProject.Bugs._Issue2887.ActualTestClass), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._Issue2887.ActualTestClass)), - Name = "ActualTestClass", - Namespace = "TUnit.TestProject.Bugs._Issue2887", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = new global::TUnit.Core.ParameterMetadata[] + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Bugs._Issue2887.IServiceProvider)) { - new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Bugs._Issue2887.IServiceProvider)) - { - Name = "serviceProvider", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._Issue2887.IServiceProvider)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._Issue2887.ActualTestClass).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.Bugs._Issue2887.IServiceProvider) })!.GetParameters()[0] - } - }, - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Name = "serviceProvider", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._Issue2887.IServiceProvider)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._Issue2887.ActualTestClass).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.Bugs._Issue2887.IServiceProvider) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => - { - // 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"); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.Test1(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -100,6 +77,31 @@ internal sealed class TUnit_TestProject_Bugs__Issue2887_ActualTestClass_Test1_Te Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.ClassConstructorAttribute() + ]; + } + private static global::TUnit.TestProject.Bugs._Issue2887.ActualTestClass __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + // 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"); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._Issue2887.ActualTestClass instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.Test1(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__Issue2887_ActualTestClass_Test1_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/MatrixTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/MatrixTests.Test.verified.txt index de4b2c7f25..9fbb5c70b1 100644 --- a/TUnit.Core.SourceGenerator.Tests/MatrixTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/MatrixTests.Test.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_b TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "MatrixTest_One", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -62,42 +58,20 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_b ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(int), typeof(bool) }, null)!.GetParameters()[2] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 3: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_One(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -120,6 +94,37 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_b Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 3: + { + return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_One(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_bool_ModuleInitializer { @@ -150,11 +155,7 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_ TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "MatrixTest_Two", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -204,42 +205,20 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_ ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int), typeof(int), typeof(bool) }, null)!.GetParameters()[3] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 4: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_Two(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 4 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -262,6 +241,37 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_ Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 4: + { + return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_Two(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 4 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_bool_ModuleInitializer { @@ -292,11 +302,7 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnu TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "MatrixTest_Enum", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -339,42 +345,20 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnu ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Enum", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(global::TUnit.TestProject.TestEnum), typeof(global::TUnit.TestProject.TestEnum?) }, null)!.GetParameters()[2] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 3: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_Enum(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -397,6 +381,37 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnu Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 3: + { + return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_Enum(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnum_TestEnum__ModuleInitializer { @@ -427,11 +442,7 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bo TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "AutoGenerateBools", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -467,42 +478,20 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bo ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("AutoGenerateBools", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(bool) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.AutoGenerateBools(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -525,6 +514,37 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bo Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 2: + { + return new global::System.Threading.Tasks.ValueTask(instance.AutoGenerateBools(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bool_ModuleInitializer { @@ -555,11 +575,7 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_b TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "AutoGenerateBools2", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -595,42 +611,20 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_b ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("AutoGenerateBools2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(bool?) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.AutoGenerateBools2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -653,6 +647,37 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_b Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 2: + { + return new global::System.Threading.Tasks.ValueTask(instance.AutoGenerateBools2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_bool__ModuleInitializer { @@ -683,11 +708,7 @@ internal sealed class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_Te TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "ImplicitConversion", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -723,42 +744,20 @@ internal sealed class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_Te ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("ImplicitConversion", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(OneOf), typeof(bool) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.ImplicitConversion(global::TUnit.Core.Helpers.CastHelper.Cast>(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -781,6 +780,37 @@ internal sealed class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_Te Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 2: + { + return new global::System.Threading.Tasks.ValueTask(instance.ImplicitConversion(global::TUnit.Core.Helpers.CastHelper.Cast>(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool_ModuleInitializer { @@ -811,11 +841,7 @@ internal sealed class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrix TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "ExcludingAutoGeneratedMatrixValues", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -851,42 +877,20 @@ internal sealed class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrix ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("ExcludingAutoGeneratedMatrixValues", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), typeof(bool) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.ExcludingAutoGeneratedMatrixValues(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -909,6 +913,37 @@ internal sealed class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrix Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 2: + { + return new global::System.Threading.Tasks.ValueTask(instance.ExcludingAutoGeneratedMatrixValues(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool_ModuleInitializer { @@ -939,11 +974,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method1__int_TestSource : gl TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Method1", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -972,42 +1003,20 @@ internal sealed class TUnit_TestProject_MatrixTests_Method1__int_TestSource : gl ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method1", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Method1(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1030,6 +1039,37 @@ internal sealed class TUnit_TestProject_MatrixTests_Method1__int_TestSource : gl Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.Method1(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_Method1__int_ModuleInitializer { @@ -1060,11 +1100,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method2__int_TestSource : gl TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Method2", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1093,42 +1129,20 @@ internal sealed class TUnit_TestProject_MatrixTests_Method2__int_TestSource : gl ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Method2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1151,6 +1165,37 @@ internal sealed class TUnit_TestProject_MatrixTests_Method2__int_TestSource : gl Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.Method2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_Method2__int_ModuleInitializer { @@ -1181,11 +1226,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : gl TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Method3", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1214,42 +1255,20 @@ internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : gl ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method3", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Method3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1272,6 +1291,37 @@ internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : gl Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.Method3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_Method3__int_ModuleInitializer { @@ -1302,11 +1352,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : gl TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Method4", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1335,42 +1381,20 @@ internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : gl ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method4", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Method4(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1393,6 +1417,37 @@ internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : gl Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.Method4(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_Method4__int_ModuleInitializer { @@ -1423,14 +1478,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSourc TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Exclusion", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.MatrixExclusionAttribute(1, 1), - new global::TUnit.Core.MatrixExclusionAttribute(2, 2), - new global::TUnit.Core.MatrixExclusionAttribute(3, 3), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1466,42 +1514,20 @@ internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSourc ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Exclusion", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.Exclusion(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1524,6 +1550,40 @@ internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSourc Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.MatrixExclusionAttribute(1, 1), + new global::TUnit.Core.MatrixExclusionAttribute(2, 2), + new global::TUnit.Core.MatrixExclusionAttribute(3, 3), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 2: + { + return new global::System.Threading.Tasks.ValueTask(instance.Exclusion(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_Exclusion__int_int_ModuleInitializer { @@ -1554,11 +1614,7 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParamet TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1594,42 +1650,20 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParamet ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool), typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MatrixTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), - Name = "MatrixTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MatrixTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1652,6 +1686,37 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParamet Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 2: + { + return new global::System.Threading.Tasks.ValueTask(instance.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__boo_38BEEE8F_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenTests.Test.verified.txt index 39f104fc47..7dca1eaf68 100644 --- a/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenTests.Test.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -59,43 +55,20 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), - Name = "MethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "MethodDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -118,6 +91,38 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method__int_ModuleInitializer { @@ -148,11 +153,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method2", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -192,43 +193,20 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), - Name = "MethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "MethodDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -251,6 +229,38 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method2__int_ModuleInitializer { @@ -281,11 +291,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method_WithAction", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeAction") @@ -325,43 +331,20 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method_WithAction", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Action) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), - Name = "MethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "MethodDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method_WithAction(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -384,6 +367,38 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method_WithAction(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method_WithAction__Action_ModuleInitializer { @@ -414,11 +429,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method3", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -473,43 +484,20 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method3", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), - Name = "MethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "MethodDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -532,6 +520,38 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method3__int_ModuleInitializer { @@ -562,11 +582,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method4", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -648,43 +664,20 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method4", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), - Name = "MethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "MethodDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method4(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -707,6 +700,38 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method4(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method4__int_ModuleInitializer { @@ -737,11 +762,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_W TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_WithBaseReturn", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("MethodWithBaseReturn") @@ -781,43 +802,20 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_W ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_WithBaseReturn", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), - Name = "MethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "MethodDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_WithBaseReturn(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -840,6 +838,38 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_W Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_WithBaseReturn(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_WithBaseReturn__BaseValue_ModuleInitializer { @@ -870,11 +900,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "EnumerableFuncArrayTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("EnumerableFuncArrayTestData") @@ -924,42 +950,20 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("EnumerableFuncArrayTest", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string[]) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), - Name = "MethodDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "MethodDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.EnumerableFuncArrayTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -982,6 +986,37 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.EnumerableFuncArrayTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFuncArrayTest__string___ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenWithCancellationTokenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenWithCancellationTokenTests.Test.verified.txt index 30be7bda96..c55c9dca2d 100644 --- a/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenWithCancellationTokenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenWithCancellationTokenTests.Test.verified.txt @@ -15,12 +15,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenWithCancellationTo TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests), TestMethodName = "MyTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Usage", "TUnit0046:Return a `Func` rather than a ``") - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("T") @@ -167,44 +162,20 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenWithCancellationTo ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests).GetMethod("MyTest", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests)), - Name = "MethodDataSourceDrivenWithCancellationTokenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests)), + Name = "MethodDataSourceDrivenWithCancellationTokenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var context = global::TUnit.Core.TestContext.Current; - switch (args.Length) - { - case 1: - { - instance.MyTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), context?.Execution.CancellationToken ?? global::System.Threading.CancellationToken.None); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -227,6 +198,40 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenWithCancellationTo Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Usage", "TUnit0046:Return a `Func` rather than a ``") + ]; + } + private static global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + var context = global::TUnit.Core.TestContext.Current; + switch (args.Length) + { + case 1: + { + instance.MyTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), context?.Execution.CancellationToken ?? global::System.Threading.CancellationToken.None); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MethodDataSourceDrivenWithCancellationTokenTests_MyTest__int_Cancell_DF7AA95A_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/MultipleClassDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/MultipleClassDataSourceDrivenTests.Test.verified.txt index e62975e0fe..372b0834db 100644 --- a/TUnit.Core.SourceGenerator.Tests/MultipleClassDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/MultipleClassDataSourceDrivenTests.Test.verified.txt @@ -15,13 +15,7 @@ internal sealed class TUnit_TestProject_MultipleClassDataSourceDrivenTests_Test1 TestClassType = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests), TestMethodName = "Test1", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.ClassDataSourceAttribute() -{Shared = new global::TUnit.Core.SharedType[]{global::TUnit.Core.SharedType.None,global::TUnit.Core.SharedType.None,global::TUnit.Core.SharedType.None,global::TUnit.Core.SharedType.None,global::TUnit.Core.SharedType.None},} - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] { @@ -42,75 +36,57 @@ internal sealed class TUnit_TestProject_MultipleClassDataSourceDrivenTests_Test1 ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MultipleClassDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MultipleClassDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata + Type = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests)), + Name = "MultipleClassDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = new global::TUnit.Core.ParameterMetadata[] { - Type = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests)), - Name = "MultipleClassDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = new global::TUnit.Core.ParameterMetadata[] + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1)) + { + Name = "inject1", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5) })!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2)) + { + Name = "inject2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5) })!.GetParameters()[1] + }, + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3)) { - new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1)) - { - Name = "inject1", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5) })!.GetParameters()[0] - }, - new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2)) - { - Name = "inject2", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5) })!.GetParameters()[1] - }, - new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3)) - { - Name = "inject3", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5) })!.GetParameters()[2] - }, - new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4)) - { - Name = "inject4", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5) })!.GetParameters()[3] - }, - new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5)) - { - Name = "inject5", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5) })!.GetParameters()[4] - } + Name = "inject3", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5) })!.GetParameters()[2] }, - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4)) + { + Name = "inject4", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5) })!.GetParameters()[3] + }, + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5)) + { + Name = "inject5", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5) })!.GetParameters()[4] + } + }, + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.MultipleClassDataSourceDrivenTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]), global::TUnit.Core.Helpers.CastHelper.Cast(args[4])); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.Test1(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -133,6 +109,32 @@ internal sealed class TUnit_TestProject_MultipleClassDataSourceDrivenTests_Test1 Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.ClassDataSourceAttribute() +{Shared = new global::TUnit.Core.SharedType[]{global::TUnit.Core.SharedType.None,global::TUnit.Core.SharedType.None,global::TUnit.Core.SharedType.None,global::TUnit.Core.SharedType.None,global::TUnit.Core.SharedType.None},} + ]; + } + private static global::TUnit.TestProject.MultipleClassDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MultipleClassDataSourceDrivenTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]), global::TUnit.Core.Helpers.CastHelper.Cast(args[4])); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.Test1(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MultipleClassDataSourceDrivenTests_Test1_ModuleInitializer { @@ -163,13 +165,7 @@ internal sealed class TUnit_TestProject_MultipleClassDataSourceDrivenTests_Test2 TestClassType = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests), TestMethodName = "Test2", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.ClassDataSourceAttribute() -{Shared = new global::TUnit.Core.SharedType[]{global::TUnit.Core.SharedType.None,global::TUnit.Core.SharedType.None,global::TUnit.Core.SharedType.None,global::TUnit.Core.SharedType.None,global::TUnit.Core.SharedType.None},} - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] { @@ -190,75 +186,57 @@ internal sealed class TUnit_TestProject_MultipleClassDataSourceDrivenTests_Test2 ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MultipleClassDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MultipleClassDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata + Type = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests)), + Name = "MultipleClassDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = new global::TUnit.Core.ParameterMetadata[] { - Type = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests)), - Name = "MultipleClassDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = new global::TUnit.Core.ParameterMetadata[] + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1)) + { + Name = "inject1", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5) })!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2)) + { + Name = "inject2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5) })!.GetParameters()[1] + }, + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3)) { - new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1)) - { - Name = "inject1", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5) })!.GetParameters()[0] - }, - new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2)) - { - Name = "inject2", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5) })!.GetParameters()[1] - }, - new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3)) - { - Name = "inject3", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5) })!.GetParameters()[2] - }, - new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4)) - { - Name = "inject4", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5) })!.GetParameters()[3] - }, - new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5)) - { - Name = "inject5", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5) })!.GetParameters()[4] - } + Name = "inject3", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5) })!.GetParameters()[2] }, - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4)) + { + Name = "inject4", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5) })!.GetParameters()[3] + }, + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5)) + { + Name = "inject5", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5) })!.GetParameters()[4] + } + }, + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.MultipleClassDataSourceDrivenTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]), global::TUnit.Core.Helpers.CastHelper.Cast(args[4])); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.Test2(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -281,6 +259,32 @@ internal sealed class TUnit_TestProject_MultipleClassDataSourceDrivenTests_Test2 Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.ClassDataSourceAttribute() +{Shared = new global::TUnit.Core.SharedType[]{global::TUnit.Core.SharedType.None,global::TUnit.Core.SharedType.None,global::TUnit.Core.SharedType.None,global::TUnit.Core.SharedType.None,global::TUnit.Core.SharedType.None},} + ]; + } + private static global::TUnit.TestProject.MultipleClassDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MultipleClassDataSourceDrivenTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]), global::TUnit.Core.Helpers.CastHelper.Cast(args[4])); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.Test2(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_MultipleClassDataSourceDrivenTests_Test2_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/NameOfArgumentTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/NameOfArgumentTests.Test.verified.txt index a6c73f21d0..0ce34f4a69 100644 --- a/TUnit.Core.SourceGenerator.Tests/NameOfArgumentTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/NameOfArgumentTests.Test.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_NameOfArgumentTests_TestName__string_Tes TestClassType = typeof(global::TUnit.TestProject.NameOfArgumentTests), TestMethodName = "TestName", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("TestName"), @@ -48,42 +44,20 @@ internal sealed class TUnit_TestProject_NameOfArgumentTests_TestName__string_Tes ReflectionInfo = typeof(global::TUnit.TestProject.NameOfArgumentTests).GetMethod("TestName", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NameOfArgumentTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NameOfArgumentTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.NameOfArgumentTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NameOfArgumentTests)), - Name = "NameOfArgumentTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.NameOfArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NameOfArgumentTests)), + Name = "NameOfArgumentTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.NameOfArgumentTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.TestName(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -106,6 +80,37 @@ internal sealed class TUnit_TestProject_NameOfArgumentTests_TestName__string_Tes Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.NameOfArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.NameOfArgumentTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NameOfArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.TestName(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_NameOfArgumentTests_TestName__string_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/NullableByteArgumentTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/NullableByteArgumentTests.Test.verified.txt index 25c61f5ba1..0a3892637d 100644 --- a/TUnit.Core.SourceGenerator.Tests/NullableByteArgumentTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/NullableByteArgumentTests.Test.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_NullableByteArgumentTests_Test__byte__Te TestClassType = typeof(global::TUnit.TestProject.NullableByteArgumentTests), TestMethodName = "Test", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute((byte) 1), @@ -49,43 +45,20 @@ internal sealed class TUnit_TestProject_NullableByteArgumentTests_Test__byte__Te ReflectionInfo = typeof(global::TUnit.TestProject.NullableByteArgumentTests).GetMethod("Test", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(byte?) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NullableByteArgumentTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NullableByteArgumentTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.NullableByteArgumentTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NullableByteArgumentTests)), - Name = "NullableByteArgumentTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.NullableByteArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NullableByteArgumentTests)), + Name = "NullableByteArgumentTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.NullableByteArgumentTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.Test(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -108,6 +81,38 @@ internal sealed class TUnit_TestProject_NullableByteArgumentTests_Test__byte__Te Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.NullableByteArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.NullableByteArgumentTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NullableByteArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.Test(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_NullableByteArgumentTests_Test__byte__ModuleInitializer { @@ -138,11 +143,7 @@ internal sealed class TUnit_TestProject_NullableByteArgumentTests_Test2__byte_by TestClassType = typeof(global::TUnit.TestProject.NullableByteArgumentTests), TestMethodName = "Test2", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute((byte) 1, (byte) 1), @@ -179,43 +180,20 @@ internal sealed class TUnit_TestProject_NullableByteArgumentTests_Test2__byte_by ReflectionInfo = typeof(global::TUnit.TestProject.NullableByteArgumentTests).GetMethod("Test2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(byte), typeof(byte?) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NullableByteArgumentTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NullableByteArgumentTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.NullableByteArgumentTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NullableByteArgumentTests)), - Name = "NullableByteArgumentTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.NullableByteArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NullableByteArgumentTests)), + Name = "NullableByteArgumentTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.NullableByteArgumentTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 2: - { - instance.Test2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -238,6 +216,38 @@ internal sealed class TUnit_TestProject_NullableByteArgumentTests_Test2__byte_by Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.NullableByteArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.NullableByteArgumentTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NullableByteArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 2: + { + instance.Test2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_NullableByteArgumentTests_Test2__byte_byte__ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.Test.verified.txt index f589df6ccc..a33ce109c8 100644 --- a/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.Test.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Int__int_TestSource TestClassType = typeof(global::TUnit.TestProject.NumberArgumentTests), TestMethodName = "Int", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1), @@ -48,43 +44,20 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Int__int_TestSource ReflectionInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Int", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.NumberArgumentTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NumberArgumentTests)), - Name = "NumberArgumentTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.NumberArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NumberArgumentTests)), + Name = "NumberArgumentTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.NumberArgumentTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.Int(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -107,6 +80,38 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Int__int_TestSource Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.NumberArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.NumberArgumentTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NumberArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.Int(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_NumberArgumentTests_Int__int_ModuleInitializer { @@ -137,11 +142,7 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Double__double_TestS TestClassType = typeof(global::TUnit.TestProject.NumberArgumentTests), TestMethodName = "Double", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1.1), @@ -170,43 +171,20 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Double__double_TestS ReflectionInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Double", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(double) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.NumberArgumentTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NumberArgumentTests)), - Name = "NumberArgumentTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.NumberArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NumberArgumentTests)), + Name = "NumberArgumentTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.NumberArgumentTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.Double(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -229,6 +207,38 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Double__double_TestS Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.NumberArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.NumberArgumentTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NumberArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.Double(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_NumberArgumentTests_Double__double_ModuleInitializer { @@ -259,11 +269,7 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Float__float_TestSou TestClassType = typeof(global::TUnit.TestProject.NumberArgumentTests), TestMethodName = "Float", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1.1f), @@ -292,43 +298,20 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Float__float_TestSou ReflectionInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Float", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(float) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.NumberArgumentTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NumberArgumentTests)), - Name = "NumberArgumentTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.NumberArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NumberArgumentTests)), + Name = "NumberArgumentTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.NumberArgumentTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.Float(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -351,6 +334,38 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Float__float_TestSou Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.NumberArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.NumberArgumentTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NumberArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.Float(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_NumberArgumentTests_Float__float_ModuleInitializer { @@ -381,11 +396,7 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Long__long_TestSourc TestClassType = typeof(global::TUnit.TestProject.NumberArgumentTests), TestMethodName = "Long", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1L), @@ -414,43 +425,20 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Long__long_TestSourc ReflectionInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Long", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(long) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.NumberArgumentTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NumberArgumentTests)), - Name = "NumberArgumentTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.NumberArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NumberArgumentTests)), + Name = "NumberArgumentTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.NumberArgumentTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.Long(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -473,6 +461,38 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Long__long_TestSourc Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.NumberArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.NumberArgumentTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NumberArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.Long(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_NumberArgumentTests_Long__long_ModuleInitializer { @@ -503,11 +523,7 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_ULong__ulong_TestSou TestClassType = typeof(global::TUnit.TestProject.NumberArgumentTests), TestMethodName = "ULong", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1UL), @@ -536,43 +552,20 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_ULong__ulong_TestSou ReflectionInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("ULong", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(ulong) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.NumberArgumentTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NumberArgumentTests)), - Name = "NumberArgumentTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.NumberArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NumberArgumentTests)), + Name = "NumberArgumentTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.NumberArgumentTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.ULong(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -595,6 +588,38 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_ULong__ulong_TestSou Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.NumberArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.NumberArgumentTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NumberArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.ULong(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_NumberArgumentTests_ULong__ulong_ModuleInitializer { @@ -625,11 +650,7 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_UInt__uint_TestSourc TestClassType = typeof(global::TUnit.TestProject.NumberArgumentTests), TestMethodName = "UInt", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1U), @@ -658,43 +679,20 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_UInt__uint_TestSourc ReflectionInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("UInt", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(uint) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.NumberArgumentTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NumberArgumentTests)), - Name = "NumberArgumentTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.NumberArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NumberArgumentTests)), + Name = "NumberArgumentTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.NumberArgumentTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.UInt(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -717,6 +715,38 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_UInt__uint_TestSourc Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.NumberArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.NumberArgumentTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NumberArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.UInt(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_NumberArgumentTests_UInt__uint_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.TestDE.verified.txt b/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.TestDE.verified.txt index f589df6ccc..a33ce109c8 100644 --- a/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.TestDE.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.TestDE.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Int__int_TestSource TestClassType = typeof(global::TUnit.TestProject.NumberArgumentTests), TestMethodName = "Int", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1), @@ -48,43 +44,20 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Int__int_TestSource ReflectionInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Int", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.NumberArgumentTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NumberArgumentTests)), - Name = "NumberArgumentTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.NumberArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NumberArgumentTests)), + Name = "NumberArgumentTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.NumberArgumentTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.Int(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -107,6 +80,38 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Int__int_TestSource Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.NumberArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.NumberArgumentTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NumberArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.Int(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_NumberArgumentTests_Int__int_ModuleInitializer { @@ -137,11 +142,7 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Double__double_TestS TestClassType = typeof(global::TUnit.TestProject.NumberArgumentTests), TestMethodName = "Double", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1.1), @@ -170,43 +171,20 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Double__double_TestS ReflectionInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Double", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(double) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.NumberArgumentTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NumberArgumentTests)), - Name = "NumberArgumentTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.NumberArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NumberArgumentTests)), + Name = "NumberArgumentTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.NumberArgumentTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.Double(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -229,6 +207,38 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Double__double_TestS Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.NumberArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.NumberArgumentTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NumberArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.Double(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_NumberArgumentTests_Double__double_ModuleInitializer { @@ -259,11 +269,7 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Float__float_TestSou TestClassType = typeof(global::TUnit.TestProject.NumberArgumentTests), TestMethodName = "Float", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1.1f), @@ -292,43 +298,20 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Float__float_TestSou ReflectionInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Float", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(float) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.NumberArgumentTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NumberArgumentTests)), - Name = "NumberArgumentTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.NumberArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NumberArgumentTests)), + Name = "NumberArgumentTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.NumberArgumentTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.Float(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -351,6 +334,38 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Float__float_TestSou Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.NumberArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.NumberArgumentTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NumberArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.Float(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_NumberArgumentTests_Float__float_ModuleInitializer { @@ -381,11 +396,7 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Long__long_TestSourc TestClassType = typeof(global::TUnit.TestProject.NumberArgumentTests), TestMethodName = "Long", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1L), @@ -414,43 +425,20 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Long__long_TestSourc ReflectionInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Long", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(long) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.NumberArgumentTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NumberArgumentTests)), - Name = "NumberArgumentTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.NumberArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NumberArgumentTests)), + Name = "NumberArgumentTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.NumberArgumentTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.Long(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -473,6 +461,38 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Long__long_TestSourc Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.NumberArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.NumberArgumentTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NumberArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.Long(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_NumberArgumentTests_Long__long_ModuleInitializer { @@ -503,11 +523,7 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_ULong__ulong_TestSou TestClassType = typeof(global::TUnit.TestProject.NumberArgumentTests), TestMethodName = "ULong", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1UL), @@ -536,43 +552,20 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_ULong__ulong_TestSou ReflectionInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("ULong", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(ulong) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.NumberArgumentTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NumberArgumentTests)), - Name = "NumberArgumentTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.NumberArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NumberArgumentTests)), + Name = "NumberArgumentTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.NumberArgumentTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.ULong(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -595,6 +588,38 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_ULong__ulong_TestSou Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.NumberArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.NumberArgumentTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NumberArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.ULong(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_NumberArgumentTests_ULong__ulong_ModuleInitializer { @@ -625,11 +650,7 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_UInt__uint_TestSourc TestClassType = typeof(global::TUnit.TestProject.NumberArgumentTests), TestMethodName = "UInt", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1U), @@ -658,43 +679,20 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_UInt__uint_TestSourc ReflectionInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("UInt", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(uint) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.NumberArgumentTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NumberArgumentTests)), - Name = "NumberArgumentTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.NumberArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NumberArgumentTests)), + Name = "NumberArgumentTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.NumberArgumentTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.UInt(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -717,6 +715,38 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_UInt__uint_TestSourc Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.NumberArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.NumberArgumentTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NumberArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.UInt(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_NumberArgumentTests_UInt__uint_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/PriorityFilteringTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/PriorityFilteringTests.Test.verified.txt index b9c22f0a81..9a2e532079 100644 --- a/TUnit.Core.SourceGenerator.Tests/PriorityFilteringTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/PriorityFilteringTests.Test.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_High_1_TestSource TestClassType = typeof(global::TUnit.TestProject.PriorityFilteringTests), TestMethodName = "High_1", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.PriorityAttribute(global::TUnit.TestProject.Enums.PriorityLevel.High) - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -36,34 +32,20 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_High_1_TestSource ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.PriorityFilteringTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.PriorityFilteringTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.PriorityFilteringTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.PriorityFilteringTests)), - Name = "PriorityFilteringTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.PriorityFilteringTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.PriorityFilteringTests)), + Name = "PriorityFilteringTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.PriorityFilteringTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.High_1()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -86,6 +68,29 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_High_1_TestSource Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.PriorityAttribute(global::TUnit.TestProject.Enums.PriorityLevel.High) + ]; + } + private static global::TUnit.TestProject.PriorityFilteringTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.PriorityFilteringTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.PriorityFilteringTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.High_1()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_PriorityFilteringTests_High_1_ModuleInitializer { @@ -116,11 +121,7 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_High_2_TestSource TestClassType = typeof(global::TUnit.TestProject.PriorityFilteringTests), TestMethodName = "High_2", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.PriorityAttribute(global::TUnit.TestProject.Enums.PriorityLevel.High) - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -137,34 +138,20 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_High_2_TestSource ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.PriorityFilteringTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.PriorityFilteringTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.PriorityFilteringTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.PriorityFilteringTests)), - Name = "PriorityFilteringTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.PriorityFilteringTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.PriorityFilteringTests)), + Name = "PriorityFilteringTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.PriorityFilteringTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.High_2()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -187,6 +174,29 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_High_2_TestSource Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.PriorityAttribute(global::TUnit.TestProject.Enums.PriorityLevel.High) + ]; + } + private static global::TUnit.TestProject.PriorityFilteringTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.PriorityFilteringTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.PriorityFilteringTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.High_2()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_PriorityFilteringTests_High_2_ModuleInitializer { @@ -217,11 +227,7 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_High_3_TestSource TestClassType = typeof(global::TUnit.TestProject.PriorityFilteringTests), TestMethodName = "High_3", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.PriorityAttribute(global::TUnit.TestProject.Enums.PriorityLevel.High) - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -238,34 +244,20 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_High_3_TestSource ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.PriorityFilteringTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.PriorityFilteringTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.PriorityFilteringTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.PriorityFilteringTests)), - Name = "PriorityFilteringTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.PriorityFilteringTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.PriorityFilteringTests)), + Name = "PriorityFilteringTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.PriorityFilteringTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.High_3()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -288,6 +280,29 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_High_3_TestSource Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.PriorityAttribute(global::TUnit.TestProject.Enums.PriorityLevel.High) + ]; + } + private static global::TUnit.TestProject.PriorityFilteringTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.PriorityFilteringTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.PriorityFilteringTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.High_3()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_PriorityFilteringTests_High_3_ModuleInitializer { @@ -318,11 +333,7 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_Medium_1_TestSour TestClassType = typeof(global::TUnit.TestProject.PriorityFilteringTests), TestMethodName = "Medium_1", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.PriorityAttribute(global::TUnit.TestProject.Enums.PriorityLevel.Medium) - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -339,34 +350,20 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_Medium_1_TestSour ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.PriorityFilteringTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.PriorityFilteringTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.PriorityFilteringTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.PriorityFilteringTests)), - Name = "PriorityFilteringTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.PriorityFilteringTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.PriorityFilteringTests)), + Name = "PriorityFilteringTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.PriorityFilteringTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.Medium_1()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -389,6 +386,29 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_Medium_1_TestSour Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.PriorityAttribute(global::TUnit.TestProject.Enums.PriorityLevel.Medium) + ]; + } + private static global::TUnit.TestProject.PriorityFilteringTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.PriorityFilteringTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.PriorityFilteringTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.Medium_1()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_PriorityFilteringTests_Medium_1_ModuleInitializer { @@ -419,11 +439,7 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_Medium_2_TestSour TestClassType = typeof(global::TUnit.TestProject.PriorityFilteringTests), TestMethodName = "Medium_2", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.PriorityAttribute(global::TUnit.TestProject.Enums.PriorityLevel.Medium) - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -440,34 +456,20 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_Medium_2_TestSour ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.PriorityFilteringTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.PriorityFilteringTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.PriorityFilteringTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.PriorityFilteringTests)), - Name = "PriorityFilteringTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.PriorityFilteringTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.PriorityFilteringTests)), + Name = "PriorityFilteringTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.PriorityFilteringTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.Medium_2()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -490,6 +492,29 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_Medium_2_TestSour Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.PriorityAttribute(global::TUnit.TestProject.Enums.PriorityLevel.Medium) + ]; + } + private static global::TUnit.TestProject.PriorityFilteringTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.PriorityFilteringTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.PriorityFilteringTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.Medium_2()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_PriorityFilteringTests_Medium_2_ModuleInitializer { @@ -520,11 +545,7 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_Low_1_TestSource TestClassType = typeof(global::TUnit.TestProject.PriorityFilteringTests), TestMethodName = "Low_1", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.PriorityAttribute(global::TUnit.TestProject.Enums.PriorityLevel.Low) - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -541,34 +562,20 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_Low_1_TestSource ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.PriorityFilteringTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.PriorityFilteringTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.PriorityFilteringTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.PriorityFilteringTests)), - Name = "PriorityFilteringTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.PriorityFilteringTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.PriorityFilteringTests)), + Name = "PriorityFilteringTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.PriorityFilteringTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.Low_1()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -591,6 +598,29 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_Low_1_TestSource Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.PriorityAttribute(global::TUnit.TestProject.Enums.PriorityLevel.Low) + ]; + } + private static global::TUnit.TestProject.PriorityFilteringTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.PriorityFilteringTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.PriorityFilteringTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.Low_1()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_PriorityFilteringTests_Low_1_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/PropertySetterTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/PropertySetterTests.Test.verified.txt index 12e9e87252..d1b0492d31 100644 --- a/TUnit.Core.SourceGenerator.Tests/PropertySetterTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/PropertySetterTests.Test.verified.txt @@ -29,12 +29,7 @@ internal sealed class TUnit_TestProject_PropertySetterTests_Test_TestSource : gl TestClassType = typeof(global::TUnit.TestProject.PropertySetterTests), TestMethodName = "Test", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.NotInParallelAttribute("PropertySetterTests") - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = new global::TUnit.Core.PropertyDataSource[] @@ -201,138 +196,110 @@ internal sealed class TUnit_TestProject_PropertySetterTests_Test_TestSource : gl ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.PropertySetterTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.PropertySetterTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata + Type = typeof(global::TUnit.TestProject.PropertySetterTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.PropertySetterTests)), + Name = "PropertySetterTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = new global::TUnit.Core.PropertyMetadata[] { - Type = typeof(global::TUnit.TestProject.PropertySetterTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.PropertySetterTests)), - Name = "PropertySetterTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = new global::TUnit.Core.PropertyMetadata[] + new global::TUnit.Core.PropertyMetadata { - new global::TUnit.Core.PropertyMetadata - { - ReflectionInfo = typeof(global::TUnit.TestProject.PropertySetterTests).GetProperty("Property1"), - Type = typeof(string), - Name = "Property1", - IsStatic = false, - IsNullable = false, - Getter = o => ((global::TUnit.TestProject.PropertySetterTests)o).Property1, - ClassMetadata = null!, - ContainingTypeMetadata = null! - }, - new global::TUnit.Core.PropertyMetadata - { - ReflectionInfo = typeof(global::TUnit.TestProject.PropertySetterTests).GetProperty("Property2"), - Type = typeof(string), - Name = "Property2", - IsStatic = false, - IsNullable = false, - Getter = o => ((global::TUnit.TestProject.PropertySetterTests)o).Property2, - ClassMetadata = null!, - ContainingTypeMetadata = null! - }, - new global::TUnit.Core.PropertyMetadata - { - ReflectionInfo = typeof(global::TUnit.TestProject.PropertySetterTests).GetProperty("Property3"), - Type = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - Name = "Property3", - IsStatic = false, - IsNullable = false, - Getter = o => ((global::TUnit.TestProject.PropertySetterTests)o).Property3, - ClassMetadata = null!, - ContainingTypeMetadata = null! - }, - new global::TUnit.Core.PropertyMetadata - { - ReflectionInfo = typeof(global::TUnit.TestProject.PropertySetterTests).GetProperty("Property4"), - Type = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - Name = "Property4", - IsStatic = false, - IsNullable = false, - Getter = o => ((global::TUnit.TestProject.PropertySetterTests)o).Property4, - ClassMetadata = null!, - ContainingTypeMetadata = null! - }, - new global::TUnit.Core.PropertyMetadata - { - ReflectionInfo = typeof(global::TUnit.TestProject.PropertySetterTests).GetProperty("Property5"), - Type = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - Name = "Property5", - IsStatic = false, - IsNullable = false, - Getter = o => ((global::TUnit.TestProject.PropertySetterTests)o).Property5, - ClassMetadata = null!, - ContainingTypeMetadata = null! - }, - new global::TUnit.Core.PropertyMetadata - { - ReflectionInfo = typeof(global::TUnit.TestProject.PropertySetterTests).GetProperty("Property6"), - Type = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - Name = "Property6", - IsStatic = false, - IsNullable = false, - Getter = o => ((global::TUnit.TestProject.PropertySetterTests)o).Property6, - ClassMetadata = null!, - ContainingTypeMetadata = null! - }, - new global::TUnit.Core.PropertyMetadata - { - ReflectionInfo = typeof(global::TUnit.TestProject.PropertySetterTests).GetProperty("Property7"), - Type = typeof(string), - Name = "Property7", - IsStatic = false, - IsNullable = false, - Getter = o => ((global::TUnit.TestProject.PropertySetterTests)o).Property7, - ClassMetadata = null!, - ContainingTypeMetadata = null! - }, - new global::TUnit.Core.PropertyMetadata - { - ReflectionInfo = typeof(global::TUnit.TestProject.PropertySetterTests).GetProperty("StaticProperty"), - Type = typeof(global::TUnit.TestProject.PropertySetterTests.StaticInnerModel), - Name = "StaticProperty", - IsStatic = true, - IsNullable = false, - Getter = _ => global::TUnit.TestProject.PropertySetterTests.StaticProperty, - ClassMetadata = null!, - ContainingTypeMetadata = null! - } + ReflectionInfo = typeof(global::TUnit.TestProject.PropertySetterTests).GetProperty("Property1"), + Type = typeof(string), + Name = "Property1", + IsStatic = false, + IsNullable = false, + Getter = o => ((global::TUnit.TestProject.PropertySetterTests)o).Property1, + ClassMetadata = null!, + ContainingTypeMetadata = null! }, - Parent = null - }; - foreach (var prop in classMetadata.Properties) - { - prop.ClassMetadata = classMetadata; - prop.ContainingTypeMetadata = classMetadata; - } - return classMetadata; + new global::TUnit.Core.PropertyMetadata + { + ReflectionInfo = typeof(global::TUnit.TestProject.PropertySetterTests).GetProperty("Property2"), + Type = typeof(string), + Name = "Property2", + IsStatic = false, + IsNullable = false, + Getter = o => ((global::TUnit.TestProject.PropertySetterTests)o).Property2, + ClassMetadata = null!, + ContainingTypeMetadata = null! + }, + new global::TUnit.Core.PropertyMetadata + { + ReflectionInfo = typeof(global::TUnit.TestProject.PropertySetterTests).GetProperty("Property3"), + Type = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), + Name = "Property3", + IsStatic = false, + IsNullable = false, + Getter = o => ((global::TUnit.TestProject.PropertySetterTests)o).Property3, + ClassMetadata = null!, + ContainingTypeMetadata = null! + }, + new global::TUnit.Core.PropertyMetadata + { + ReflectionInfo = typeof(global::TUnit.TestProject.PropertySetterTests).GetProperty("Property4"), + Type = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), + Name = "Property4", + IsStatic = false, + IsNullable = false, + Getter = o => ((global::TUnit.TestProject.PropertySetterTests)o).Property4, + ClassMetadata = null!, + ContainingTypeMetadata = null! + }, + new global::TUnit.Core.PropertyMetadata + { + ReflectionInfo = typeof(global::TUnit.TestProject.PropertySetterTests).GetProperty("Property5"), + Type = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), + Name = "Property5", + IsStatic = false, + IsNullable = false, + Getter = o => ((global::TUnit.TestProject.PropertySetterTests)o).Property5, + ClassMetadata = null!, + ContainingTypeMetadata = null! + }, + new global::TUnit.Core.PropertyMetadata + { + ReflectionInfo = typeof(global::TUnit.TestProject.PropertySetterTests).GetProperty("Property6"), + Type = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), + Name = "Property6", + IsStatic = false, + IsNullable = false, + Getter = o => ((global::TUnit.TestProject.PropertySetterTests)o).Property6, + ClassMetadata = null!, + ContainingTypeMetadata = null! + }, + new global::TUnit.Core.PropertyMetadata + { + ReflectionInfo = typeof(global::TUnit.TestProject.PropertySetterTests).GetProperty("Property7"), + Type = typeof(string), + Name = "Property7", + IsStatic = false, + IsNullable = false, + Getter = o => ((global::TUnit.TestProject.PropertySetterTests)o).Property7, + ClassMetadata = null!, + ContainingTypeMetadata = null! + }, + new global::TUnit.Core.PropertyMetadata + { + ReflectionInfo = typeof(global::TUnit.TestProject.PropertySetterTests).GetProperty("StaticProperty"), + Type = typeof(global::TUnit.TestProject.PropertySetterTests.StaticInnerModel), + Name = "StaticProperty", + IsStatic = true, + IsNullable = false, + Getter = _ => global::TUnit.TestProject.PropertySetterTests.StaticProperty, + ClassMetadata = null!, + ContainingTypeMetadata = null! + } + }, + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.PropertySetterTests() - { - Property1 = default!, - Property2 = default!, - Property3 = default!, - Property4 = default!, - Property5 = default!, - Property6 = default!, - Property7 = default!, - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.Test()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -355,6 +322,39 @@ internal sealed class TUnit_TestProject_PropertySetterTests_Test_TestSource : gl Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.NotInParallelAttribute("PropertySetterTests") + ]; + } + private static global::TUnit.TestProject.PropertySetterTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.PropertySetterTests() + { + Property1 = default!, + Property2 = default!, + Property3 = default!, + Property4 = default!, + Property5 = default!, + Property6 = default!, + Property7 = default!, + }; + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.PropertySetterTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.Test()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_PropertySetterTests_Test_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/RepeatTests.Assembly_Level_Repeat.verified.txt b/TUnit.Core.SourceGenerator.Tests/RepeatTests.Assembly_Level_Repeat.verified.txt index 51bf68a273..83210ab5f7 100644 --- a/TUnit.Core.SourceGenerator.Tests/RepeatTests.Assembly_Level_Repeat.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/RepeatTests.Assembly_Level_Repeat.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_AssemblyRepeatTests_TestWithAssemblyRepe TestClassType = typeof(global::TUnit.TestProject.AssemblyRepeatTests), TestMethodName = "TestWithAssemblyRepeat", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.RepeatAttribute(3) - ], + AttributeFactory = __CreateAttributes, RepeatCount = 3, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -37,35 +33,20 @@ internal sealed class TUnit_TestProject_AssemblyRepeatTests_TestWithAssemblyRepe ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AssemblyRepeatTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AssemblyRepeatTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AssemblyRepeatTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AssemblyRepeatTests)), - Name = "AssemblyRepeatTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AssemblyRepeatTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AssemblyRepeatTests)), + Name = "AssemblyRepeatTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.AssemblyRepeatTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.TestWithAssemblyRepeat(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -88,6 +69,30 @@ internal sealed class TUnit_TestProject_AssemblyRepeatTests_TestWithAssemblyRepe Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.RepeatAttribute(3) + ]; + } + private static global::TUnit.TestProject.AssemblyRepeatTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.AssemblyRepeatTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AssemblyRepeatTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.TestWithAssemblyRepeat(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_AssemblyRepeatTests_TestWithAssemblyRepeat_ModuleInitializer { @@ -118,12 +123,7 @@ internal sealed class TUnit_TestProject_AssemblyRepeatTests_TestWithMethodRepeat TestClassType = typeof(global::TUnit.TestProject.AssemblyRepeatTests), TestMethodName = "TestWithMethodRepeatOverride", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.RepeatAttribute(1), - new global::TUnit.Core.RepeatAttribute(3) - ], + AttributeFactory = __CreateAttributes, RepeatCount = 1, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -141,35 +141,20 @@ internal sealed class TUnit_TestProject_AssemblyRepeatTests_TestWithMethodRepeat ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AssemblyRepeatTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AssemblyRepeatTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AssemblyRepeatTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AssemblyRepeatTests)), - Name = "AssemblyRepeatTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AssemblyRepeatTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AssemblyRepeatTests)), + Name = "AssemblyRepeatTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.AssemblyRepeatTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.TestWithMethodRepeatOverride(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -192,6 +177,31 @@ internal sealed class TUnit_TestProject_AssemblyRepeatTests_TestWithMethodRepeat Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.RepeatAttribute(1), + new global::TUnit.Core.RepeatAttribute(3) + ]; + } + private static global::TUnit.TestProject.AssemblyRepeatTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.AssemblyRepeatTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AssemblyRepeatTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.TestWithMethodRepeatOverride(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_AssemblyRepeatTests_TestWithMethodRepeatOverride_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/RepeatTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/RepeatTests.Test.verified.txt index eb3105ea86..e3a3026946 100644 --- a/TUnit.Core.SourceGenerator.Tests/RepeatTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/RepeatTests.Test.verified.txt @@ -15,13 +15,7 @@ internal sealed class TUnit_TestProject_RepeatTests_One_TestSource : global::TUn TestClassType = typeof(global::TUnit.TestProject.RepeatTests), TestMethodName = "One", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.RepeatAttribute(1), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RepeatAttribute(3) - ], + AttributeFactory = __CreateAttributes, RepeatCount = 1, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -39,35 +33,20 @@ internal sealed class TUnit_TestProject_RepeatTests_One_TestSource : global::TUn ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.RepeatTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.RepeatTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.RepeatTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.RepeatTests)), - Name = "RepeatTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.RepeatTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.RepeatTests)), + Name = "RepeatTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.RepeatTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.One(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -90,6 +69,32 @@ internal sealed class TUnit_TestProject_RepeatTests_One_TestSource : global::TUn Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.RepeatAttribute(1), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RepeatAttribute(3) + ]; + } + private static global::TUnit.TestProject.RepeatTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.RepeatTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.RepeatTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.One(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_RepeatTests_One_ModuleInitializer { @@ -120,13 +125,7 @@ internal sealed class TUnit_TestProject_RepeatTests_Two_TestSource : global::TUn TestClassType = typeof(global::TUnit.TestProject.RepeatTests), TestMethodName = "Two", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.RepeatAttribute(2), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RepeatAttribute(3) - ], + AttributeFactory = __CreateAttributes, RepeatCount = 2, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -144,35 +143,20 @@ internal sealed class TUnit_TestProject_RepeatTests_Two_TestSource : global::TUn ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.RepeatTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.RepeatTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.RepeatTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.RepeatTests)), - Name = "RepeatTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.RepeatTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.RepeatTests)), + Name = "RepeatTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.RepeatTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.Two(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -195,6 +179,32 @@ internal sealed class TUnit_TestProject_RepeatTests_Two_TestSource : global::TUn Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.RepeatAttribute(2), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RepeatAttribute(3) + ]; + } + private static global::TUnit.TestProject.RepeatTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.RepeatTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.RepeatTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.Two(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_RepeatTests_Two_ModuleInitializer { @@ -225,12 +235,7 @@ internal sealed class TUnit_TestProject_RepeatTests_Three_TestSource : global::T TestClassType = typeof(global::TUnit.TestProject.RepeatTests), TestMethodName = "Three", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RepeatAttribute(3) - ], + AttributeFactory = __CreateAttributes, RepeatCount = 3, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -248,35 +253,20 @@ internal sealed class TUnit_TestProject_RepeatTests_Three_TestSource : global::T ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.RepeatTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.RepeatTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.RepeatTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.RepeatTests)), - Name = "RepeatTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.RepeatTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.RepeatTests)), + Name = "RepeatTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.RepeatTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.Three(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -299,6 +289,31 @@ internal sealed class TUnit_TestProject_RepeatTests_Three_TestSource : global::T Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RepeatAttribute(3) + ]; + } + private static global::TUnit.TestProject.RepeatTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.RepeatTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.RepeatTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.Three(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_RepeatTests_Three_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet10_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet10_0.verified.txt index fdd908b1b6..b084168f20 100644 --- a/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet10_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet10_0.verified.txt @@ -15,15 +15,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_With_STA_TestSource : glo TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "With_STA", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -41,34 +33,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_With_STA_TestSource : glo ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.With_STA()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -91,6 +69,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_With_STA_TestSource : glo Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.With_STA()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_With_STA_ModuleInitializer { @@ -121,14 +126,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_Without_STA_TestSource : TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "Without_STA", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -146,34 +144,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_Without_STA_TestSource : ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.Without_STA()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -196,6 +180,32 @@ internal sealed class TUnit_TestProject_STAThreadTests_Without_STA_TestSource : Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.Without_STA()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_Without_STA_ModuleInitializer { @@ -226,15 +236,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_TestS TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithSimpleAwait", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -252,34 +254,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_TestS ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithSimpleAwait()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -302,6 +290,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_TestS Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.STA_WithSimpleAwait()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_ModuleInitializer { @@ -332,15 +347,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskYield_TestSou TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithTaskYield", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -358,34 +365,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskYield_TestSou ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskYield()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -408,6 +401,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskYield_TestSou Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskYield()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_STA_WithTaskYield_ModuleInitializer { @@ -438,15 +458,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTru TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithConfigureAwaitTrue", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -464,34 +476,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTru ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithConfigureAwaitTrue()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -514,6 +512,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTru Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.STA_WithConfigureAwaitTrue()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTrue_ModuleInitializer { @@ -544,15 +569,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_ TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithNestedAsyncCalls", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -570,34 +587,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_ ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithNestedAsyncCalls()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -620,6 +623,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_ Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.STA_WithNestedAsyncCalls()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_ModuleInitializer { @@ -650,15 +680,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_Te TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithTaskFromResult", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -676,34 +698,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_Te ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskFromResult()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -726,6 +734,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_Te Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskFromResult()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_ModuleInitializer { @@ -756,15 +791,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_Tes TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithCompletedTask", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -782,34 +809,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_Tes ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithCompletedTask()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -832,6 +845,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_Tes Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.STA_WithCompletedTask()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_ModuleInitializer { @@ -862,15 +902,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskRun_TestSourc TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithTaskRun", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -888,34 +920,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskRun_TestSourc ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskRun()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -938,6 +956,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskRun_TestSourc Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskRun()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_STA_WithTaskRun_ModuleInitializer { @@ -968,15 +1013,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_Te TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithMultipleAwaits", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -994,34 +1031,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_Te ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithMultipleAwaits()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1044,6 +1067,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_Te Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.STA_WithMultipleAwaits()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_ModuleInitializer { @@ -1074,15 +1124,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_T TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithAsyncEnumerable", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -1100,34 +1142,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_T ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithAsyncEnumerable()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1150,6 +1178,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_T Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.STA_WithAsyncEnumerable()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_ModuleInitializer { @@ -1180,15 +1235,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_TestS TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithTaskWhenAll", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -1206,34 +1253,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_TestS ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskWhenAll()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1256,6 +1289,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_TestS Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskWhenAll()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_ModuleInitializer { @@ -1286,15 +1346,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithExceptionHandling", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -1312,34 +1364,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithExceptionHandling()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1362,6 +1400,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.STA_WithExceptionHandling()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling_ModuleInitializer { @@ -1392,15 +1457,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAsse TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithThrowsNothingAssertion", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -1418,34 +1475,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAsse ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithThrowsNothingAssertion()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1468,6 +1511,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAsse Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.STA_WithThrowsNothingAssertion()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAssertion_ModuleInitializer { @@ -1498,15 +1568,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_Tes TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithFuncAssertion", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -1524,34 +1586,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_Tes ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithFuncAssertion()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1574,6 +1622,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_Tes Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.STA_WithFuncAssertion()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_ModuleInitializer { 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 fdd908b1b6..b084168f20 100644 --- a/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet8_0.verified.txt @@ -15,15 +15,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_With_STA_TestSource : glo TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "With_STA", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -41,34 +33,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_With_STA_TestSource : glo ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.With_STA()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -91,6 +69,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_With_STA_TestSource : glo Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.With_STA()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_With_STA_ModuleInitializer { @@ -121,14 +126,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_Without_STA_TestSource : TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "Without_STA", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -146,34 +144,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_Without_STA_TestSource : ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.Without_STA()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -196,6 +180,32 @@ internal sealed class TUnit_TestProject_STAThreadTests_Without_STA_TestSource : Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.Without_STA()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_Without_STA_ModuleInitializer { @@ -226,15 +236,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_TestS TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithSimpleAwait", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -252,34 +254,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_TestS ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithSimpleAwait()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -302,6 +290,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_TestS Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.STA_WithSimpleAwait()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_ModuleInitializer { @@ -332,15 +347,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskYield_TestSou TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithTaskYield", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -358,34 +365,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskYield_TestSou ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskYield()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -408,6 +401,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskYield_TestSou Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskYield()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_STA_WithTaskYield_ModuleInitializer { @@ -438,15 +458,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTru TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithConfigureAwaitTrue", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -464,34 +476,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTru ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithConfigureAwaitTrue()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -514,6 +512,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTru Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.STA_WithConfigureAwaitTrue()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTrue_ModuleInitializer { @@ -544,15 +569,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_ TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithNestedAsyncCalls", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -570,34 +587,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_ ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithNestedAsyncCalls()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -620,6 +623,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_ Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.STA_WithNestedAsyncCalls()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_ModuleInitializer { @@ -650,15 +680,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_Te TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithTaskFromResult", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -676,34 +698,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_Te ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskFromResult()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -726,6 +734,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_Te Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskFromResult()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_ModuleInitializer { @@ -756,15 +791,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_Tes TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithCompletedTask", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -782,34 +809,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_Tes ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithCompletedTask()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -832,6 +845,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_Tes Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.STA_WithCompletedTask()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_ModuleInitializer { @@ -862,15 +902,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskRun_TestSourc TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithTaskRun", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -888,34 +920,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskRun_TestSourc ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskRun()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -938,6 +956,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskRun_TestSourc Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskRun()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_STA_WithTaskRun_ModuleInitializer { @@ -968,15 +1013,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_Te TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithMultipleAwaits", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -994,34 +1031,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_Te ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithMultipleAwaits()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1044,6 +1067,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_Te Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.STA_WithMultipleAwaits()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_ModuleInitializer { @@ -1074,15 +1124,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_T TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithAsyncEnumerable", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -1100,34 +1142,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_T ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithAsyncEnumerable()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1150,6 +1178,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_T Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.STA_WithAsyncEnumerable()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_ModuleInitializer { @@ -1180,15 +1235,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_TestS TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithTaskWhenAll", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -1206,34 +1253,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_TestS ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskWhenAll()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1256,6 +1289,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_TestS Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskWhenAll()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_ModuleInitializer { @@ -1286,15 +1346,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithExceptionHandling", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -1312,34 +1364,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithExceptionHandling()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1362,6 +1400,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.STA_WithExceptionHandling()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling_ModuleInitializer { @@ -1392,15 +1457,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAsse TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithThrowsNothingAssertion", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -1418,34 +1475,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAsse ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithThrowsNothingAssertion()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1468,6 +1511,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAsse Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.STA_WithThrowsNothingAssertion()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAssertion_ModuleInitializer { @@ -1498,15 +1568,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_Tes TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithFuncAssertion", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -1524,34 +1586,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_Tes ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithFuncAssertion()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1574,6 +1622,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_Tes Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.STA_WithFuncAssertion()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_ModuleInitializer { 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 fdd908b1b6..b084168f20 100644 --- a/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet9_0.verified.txt @@ -15,15 +15,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_With_STA_TestSource : glo TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "With_STA", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -41,34 +33,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_With_STA_TestSource : glo ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.With_STA()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -91,6 +69,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_With_STA_TestSource : glo Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.With_STA()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_With_STA_ModuleInitializer { @@ -121,14 +126,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_Without_STA_TestSource : TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "Without_STA", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -146,34 +144,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_Without_STA_TestSource : ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.Without_STA()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -196,6 +180,32 @@ internal sealed class TUnit_TestProject_STAThreadTests_Without_STA_TestSource : Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.Without_STA()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_Without_STA_ModuleInitializer { @@ -226,15 +236,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_TestS TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithSimpleAwait", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -252,34 +254,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_TestS ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithSimpleAwait()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -302,6 +290,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_TestS Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.STA_WithSimpleAwait()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_ModuleInitializer { @@ -332,15 +347,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskYield_TestSou TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithTaskYield", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -358,34 +365,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskYield_TestSou ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskYield()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -408,6 +401,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskYield_TestSou Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskYield()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_STA_WithTaskYield_ModuleInitializer { @@ -438,15 +458,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTru TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithConfigureAwaitTrue", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -464,34 +476,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTru ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithConfigureAwaitTrue()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -514,6 +512,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTru Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.STA_WithConfigureAwaitTrue()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTrue_ModuleInitializer { @@ -544,15 +569,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_ TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithNestedAsyncCalls", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -570,34 +587,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_ ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithNestedAsyncCalls()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -620,6 +623,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_ Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.STA_WithNestedAsyncCalls()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_ModuleInitializer { @@ -650,15 +680,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_Te TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithTaskFromResult", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -676,34 +698,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_Te ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskFromResult()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -726,6 +734,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_Te Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskFromResult()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_ModuleInitializer { @@ -756,15 +791,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_Tes TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithCompletedTask", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -782,34 +809,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_Tes ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithCompletedTask()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -832,6 +845,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_Tes Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.STA_WithCompletedTask()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_ModuleInitializer { @@ -862,15 +902,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskRun_TestSourc TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithTaskRun", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -888,34 +920,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskRun_TestSourc ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskRun()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -938,6 +956,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskRun_TestSourc Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskRun()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_STA_WithTaskRun_ModuleInitializer { @@ -968,15 +1013,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_Te TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithMultipleAwaits", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -994,34 +1031,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_Te ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithMultipleAwaits()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1044,6 +1067,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_Te Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.STA_WithMultipleAwaits()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_ModuleInitializer { @@ -1074,15 +1124,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_T TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithAsyncEnumerable", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -1100,34 +1142,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_T ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithAsyncEnumerable()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1150,6 +1178,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_T Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.STA_WithAsyncEnumerable()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_ModuleInitializer { @@ -1180,15 +1235,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_TestS TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithTaskWhenAll", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -1206,34 +1253,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_TestS ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskWhenAll()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1256,6 +1289,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_TestS Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskWhenAll()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_ModuleInitializer { @@ -1286,15 +1346,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithExceptionHandling", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -1312,34 +1364,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithExceptionHandling()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1362,6 +1400,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.STA_WithExceptionHandling()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling_ModuleInitializer { @@ -1392,15 +1457,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAsse TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithThrowsNothingAssertion", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -1418,34 +1475,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAsse ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithThrowsNothingAssertion()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1468,6 +1511,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAsse Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.STA_WithThrowsNothingAssertion()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAssertion_ModuleInitializer { @@ -1498,15 +1568,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_Tes TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithFuncAssertion", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ], + AttributeFactory = __CreateAttributes, RepeatCount = 100, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), @@ -1524,34 +1586,20 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_Tes ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.STAThreadTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STAThreadTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STAThreadTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.STAThreadTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithFuncAssertion()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1574,6 +1622,33 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_Tes Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), + new global::TUnit.Core.RepeatAttribute(100), + new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") + ]; + } + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.STA_WithFuncAssertion()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/StringArgumentTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/StringArgumentTests.Test.verified.txt index 0d4fa0e455..a4ab51e5b0 100644 --- a/TUnit.Core.SourceGenerator.Tests/StringArgumentTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/StringArgumentTests.Test.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_StringArgumentTests_Normal__string_TestS TestClassType = typeof(global::TUnit.TestProject.StringArgumentTests), TestMethodName = "Normal", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(""), @@ -59,43 +55,20 @@ internal sealed class TUnit_TestProject_StringArgumentTests_Normal__string_TestS ReflectionInfo = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Normal", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.StringArgumentTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.StringArgumentTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.StringArgumentTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.StringArgumentTests)), - Name = "StringArgumentTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.StringArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.StringArgumentTests)), + Name = "StringArgumentTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.StringArgumentTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.Normal(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -118,6 +91,38 @@ internal sealed class TUnit_TestProject_StringArgumentTests_Normal__string_TestS Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.StringArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.StringArgumentTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.StringArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.Normal(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_StringArgumentTests_Normal__string_ModuleInitializer { @@ -148,11 +153,7 @@ internal sealed class TUnit_TestProject_StringArgumentTests_Nullable__string__Te TestClassType = typeof(global::TUnit.TestProject.StringArgumentTests), TestMethodName = "Nullable", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(""), @@ -188,43 +189,20 @@ internal sealed class TUnit_TestProject_StringArgumentTests_Nullable__string__Te ReflectionInfo = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Nullable", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.StringArgumentTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.StringArgumentTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.StringArgumentTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.StringArgumentTests)), - Name = "StringArgumentTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.StringArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.StringArgumentTests)), + Name = "StringArgumentTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.StringArgumentTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.Nullable(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -247,6 +225,38 @@ internal sealed class TUnit_TestProject_StringArgumentTests_Nullable__string__Te Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.StringArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.StringArgumentTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.StringArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.Nullable(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_StringArgumentTests_Nullable__string__ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/Tests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests.Test.verified.txt index e34ac2c1a1..a7c08e8f86 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests.Test.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_Bugs__1304_Tests_TryParse_InvalidString_ TestClassType = typeof(global::TUnit.TestProject.Bugs._1304.Tests), TestMethodName = "TryParse_InvalidString_ReturnsFailure", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("\"2c48c152-7cb7-4f51-8f01-704454f36e60\""), @@ -59,43 +55,20 @@ internal sealed class TUnit_TestProject_Bugs__1304_Tests_TryParse_InvalidString_ ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1304.Tests).GetMethod("TryParse_InvalidString_ReturnsFailure", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1304.Tests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1304.Tests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._1304.Tests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1304.Tests)), - Name = "Tests", - Namespace = "TUnit.TestProject.Bugs._1304", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._1304.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1304.Tests)), + Name = "Tests", + Namespace = "TUnit.TestProject.Bugs._1304", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.Bugs._1304.Tests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var context = global::TUnit.Core.TestContext.Current; - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.TryParse_InvalidString_ReturnsFailure(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), context?.Execution.CancellationToken ?? global::System.Threading.CancellationToken.None)); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -118,6 +91,38 @@ internal sealed class TUnit_TestProject_Bugs__1304_Tests_TryParse_InvalidString_ Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.Bugs._1304.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._1304.Tests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1304.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + var context = global::TUnit.Core.TestContext.Current; + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.TryParse_InvalidString_ReturnsFailure(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), context?.Execution.CancellationToken ?? global::System.Threading.CancellationToken.None)); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__1304_Tests_TryParse_InvalidString_ReturnsFailure__string__Canc_9F7FA274_ModuleInitializer { @@ -148,11 +153,7 @@ internal sealed class TUnit_TestProject_Bugs__1304_Tests_Parse_InvalidString_Thr TestClassType = typeof(global::TUnit.TestProject.Bugs._1304.Tests), TestMethodName = "Parse_InvalidString_ThrowsException", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("\"2c48c152-7cb7-4f51-8f01-704454f36e60\""), @@ -185,42 +186,20 @@ internal sealed class TUnit_TestProject_Bugs__1304_Tests_Parse_InvalidString_Thr ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1304.Tests).GetMethod("Parse_InvalidString_ThrowsException", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1304.Tests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1304.Tests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._1304.Tests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1304.Tests)), - Name = "Tests", - Namespace = "TUnit.TestProject.Bugs._1304", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._1304.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1304.Tests)), + Name = "Tests", + Namespace = "TUnit.TestProject.Bugs._1304", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.Bugs._1304.Tests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Parse_InvalidString_ThrowsException(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -243,6 +222,37 @@ internal sealed class TUnit_TestProject_Bugs__1304_Tests_Parse_InvalidString_Thr Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.Bugs._1304.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._1304.Tests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1304.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.Parse_InvalidString_ThrowsException(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__1304_Tests_Parse_InvalidString_ThrowsException__string__ModuleInitializer { @@ -273,11 +283,7 @@ internal sealed class TUnit_TestProject_Bugs__1304_Tests_TryParse_ValidString_Re TestClassType = typeof(global::TUnit.TestProject.Bugs._1304.Tests), TestMethodName = "TryParse_ValidString_ReturnsAccountId", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("2c48c152-7cb7-4f51-8f01-704454f36e60"), @@ -307,42 +313,20 @@ internal sealed class TUnit_TestProject_Bugs__1304_Tests_TryParse_ValidString_Re ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1304.Tests).GetMethod("TryParse_ValidString_ReturnsAccountId", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1304.Tests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1304.Tests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._1304.Tests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1304.Tests)), - Name = "Tests", - Namespace = "TUnit.TestProject.Bugs._1304", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._1304.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1304.Tests)), + Name = "Tests", + Namespace = "TUnit.TestProject.Bugs._1304", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.Bugs._1304.Tests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.TryParse_ValidString_ReturnsAccountId(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -365,6 +349,37 @@ internal sealed class TUnit_TestProject_Bugs__1304_Tests_TryParse_ValidString_Re Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.Bugs._1304.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._1304.Tests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1304.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.TryParse_ValidString_ReturnsAccountId(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__1304_Tests_TryParse_ValidString_ReturnsAccountId__string_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1538.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1538.Test.verified.txt index f46e5a1216..b4ba6b7b8d 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1538.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1538.Test.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_Bugs__1538_Tests_Eight_Args__bool_string TestClassType = typeof(global::TUnit.TestProject.Bugs._1538.Tests), TestMethodName = "Eight_Args", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("EightItems") @@ -118,43 +114,20 @@ internal sealed class TUnit_TestProject_Bugs__1538_Tests_Eight_Args__bool_string ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1538.Tests).GetMethod("Eight_Args", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string) }, null)!.GetParameters()[7] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1538.Tests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1538.Tests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._1538.Tests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1538.Tests)), - Name = "Tests", - Namespace = "TUnit.TestProject.Bugs._1538", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._1538.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1538.Tests)), + Name = "Tests", + Namespace = "TUnit.TestProject.Bugs._1538", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.Bugs._1538.Tests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 8: - { - instance.Eight_Args(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]), global::TUnit.Core.Helpers.CastHelper.Cast(args[4]), global::TUnit.Core.Helpers.CastHelper.Cast(args[5]), global::TUnit.Core.Helpers.CastHelper.Cast(args[6]), global::TUnit.Core.Helpers.CastHelper.Cast(args[7])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 8 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -177,6 +150,38 @@ internal sealed class TUnit_TestProject_Bugs__1538_Tests_Eight_Args__bool_string Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.Bugs._1538.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._1538.Tests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1538.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 8: + { + instance.Eight_Args(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]), global::TUnit.Core.Helpers.CastHelper.Cast(args[4]), global::TUnit.Core.Helpers.CastHelper.Cast(args[5]), global::TUnit.Core.Helpers.CastHelper.Cast(args[6]), global::TUnit.Core.Helpers.CastHelper.Cast(args[7])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 8 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__1538_Tests_Eight_Args__bool_string__string__string__string__st_35276EED_ModuleInitializer { @@ -207,11 +212,7 @@ internal sealed class TUnit_TestProject_Bugs__1538_Tests_SixteenArgs__bool_strin TestClassType = typeof(global::TUnit.TestProject.Bugs._1538.Tests), TestMethodName = "SixteenArgs", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SixteenItems") @@ -366,43 +367,20 @@ internal sealed class TUnit_TestProject_Bugs__1538_Tests_SixteenArgs__bool_strin ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1538.Tests).GetMethod("SixteenArgs", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string) }, null)!.GetParameters()[15] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1538.Tests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1538.Tests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._1538.Tests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1538.Tests)), - Name = "Tests", - Namespace = "TUnit.TestProject.Bugs._1538", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._1538.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1538.Tests)), + Name = "Tests", + Namespace = "TUnit.TestProject.Bugs._1538", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.Bugs._1538.Tests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 16: - { - instance.SixteenArgs(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]), global::TUnit.Core.Helpers.CastHelper.Cast(args[4]), global::TUnit.Core.Helpers.CastHelper.Cast(args[5]), global::TUnit.Core.Helpers.CastHelper.Cast(args[6]), global::TUnit.Core.Helpers.CastHelper.Cast(args[7]), global::TUnit.Core.Helpers.CastHelper.Cast(args[8]), global::TUnit.Core.Helpers.CastHelper.Cast(args[9]), global::TUnit.Core.Helpers.CastHelper.Cast(args[10]), global::TUnit.Core.Helpers.CastHelper.Cast(args[11]), global::TUnit.Core.Helpers.CastHelper.Cast(args[12]), global::TUnit.Core.Helpers.CastHelper.Cast(args[13]), global::TUnit.Core.Helpers.CastHelper.Cast(args[14]), global::TUnit.Core.Helpers.CastHelper.Cast(args[15])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 16 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -425,6 +403,38 @@ internal sealed class TUnit_TestProject_Bugs__1538_Tests_SixteenArgs__bool_strin Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.Bugs._1538.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._1538.Tests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1538.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 16: + { + instance.SixteenArgs(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]), global::TUnit.Core.Helpers.CastHelper.Cast(args[4]), global::TUnit.Core.Helpers.CastHelper.Cast(args[5]), global::TUnit.Core.Helpers.CastHelper.Cast(args[6]), global::TUnit.Core.Helpers.CastHelper.Cast(args[7]), global::TUnit.Core.Helpers.CastHelper.Cast(args[8]), global::TUnit.Core.Helpers.CastHelper.Cast(args[9]), global::TUnit.Core.Helpers.CastHelper.Cast(args[10]), global::TUnit.Core.Helpers.CastHelper.Cast(args[11]), global::TUnit.Core.Helpers.CastHelper.Cast(args[12]), global::TUnit.Core.Helpers.CastHelper.Cast(args[13]), global::TUnit.Core.Helpers.CastHelper.Cast(args[14]), global::TUnit.Core.Helpers.CastHelper.Cast(args[15])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 16 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__1538_Tests_SixteenArgs__bool_string__string__string__string__s_972B9C97_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1539.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1539.Test.verified.txt index 4551490733..4a6ffc898f 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1539.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1539.Test.verified.txt @@ -15,15 +15,7 @@ internal sealed class TUnit_TestProject_Bugs__1539_Tests_Test_TestSource : globa TestClassType = typeof(global::TUnit.TestProject.Bugs._1539.Tests), TestMethodName = "Test", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Bugs._1539.Tests.AttributeWithPositionalArgs(), - new global::TUnit.TestProject.Bugs._1539.Tests.AttributeWithPositionalArgs(11), - new global::TUnit.TestProject.Bugs._1539.Tests.AttributeWithPositionalArgs(two: "two"), - new global::TUnit.TestProject.Bugs._1539.Tests.AttributeWithPositionalArgs(three: false), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -40,35 +32,20 @@ internal sealed class TUnit_TestProject_Bugs__1539_Tests_Test_TestSource : globa ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1539.Tests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1539.Tests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._1539.Tests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1539.Tests)), - Name = "Tests", - Namespace = "TUnit.TestProject.Bugs._1539", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._1539.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1539.Tests)), + Name = "Tests", + Namespace = "TUnit.TestProject.Bugs._1539", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.Bugs._1539.Tests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.Test(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -91,6 +68,34 @@ internal sealed class TUnit_TestProject_Bugs__1539_Tests_Test_TestSource : globa Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Bugs._1539.Tests.AttributeWithPositionalArgs(), + new global::TUnit.TestProject.Bugs._1539.Tests.AttributeWithPositionalArgs(11), + new global::TUnit.TestProject.Bugs._1539.Tests.AttributeWithPositionalArgs(two: "two"), + new global::TUnit.TestProject.Bugs._1539.Tests.AttributeWithPositionalArgs(three: false), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.Bugs._1539.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._1539.Tests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1539.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.Test(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__1539_Tests_Test_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1589.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1589.Test.verified.txt index 0da7af9a9e..d4649937f3 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1589.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1589.Test.verified.txt @@ -15,13 +15,7 @@ internal sealed class TUnit_TestProject_Bugs__1589_MyTests_Test1_TestSource : gl TestClassType = typeof(global::TUnit.TestProject.Bugs._1589.MyTests), TestMethodName = "Test1", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.ClassDataSourceAttribute() -{Shared = global::TUnit.Core.SharedType.None,} - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] { @@ -42,46 +36,29 @@ internal sealed class TUnit_TestProject_Bugs__1589_MyTests_Test1_TestSource : gl ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1589.MyTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1589.MyTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata + Type = typeof(global::TUnit.TestProject.Bugs._1589.MyTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1589.MyTests)), + Name = "MyTests", + Namespace = "TUnit.TestProject.Bugs._1589", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = new global::TUnit.Core.ParameterMetadata[] { - Type = typeof(global::TUnit.TestProject.Bugs._1589.MyTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1589.MyTests)), - Name = "MyTests", - Namespace = "TUnit.TestProject.Bugs._1589", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = new global::TUnit.Core.ParameterMetadata[] + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Bugs._1589.MyFixture)) { - new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Bugs._1589.MyFixture)) - { - Name = "myFixture", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1589.MyFixture)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1589.MyTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.Bugs._1589.MyFixture) })!.GetParameters()[0] - } - }, - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Name = "myFixture", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1589.MyFixture)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1589.MyTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.Bugs._1589.MyFixture) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.Bugs._1589.MyTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.Test1()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -104,6 +81,31 @@ internal sealed class TUnit_TestProject_Bugs__1589_MyTests_Test1_TestSource : gl Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.ClassDataSourceAttribute() +{Shared = global::TUnit.Core.SharedType.None,} + ]; + } + private static global::TUnit.TestProject.Bugs._1589.MyTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._1589.MyTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1589.MyTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.Test1()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__1589_MyTests_Test1_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1594.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1594.Test.verified.txt index e1f3db50a7..5a987b317f 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1594.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1594.Test.verified.txt @@ -15,13 +15,7 @@ internal sealed class TUnit_TestProject_Bugs__1594_MyTests_Test1_TestSource : gl TestClassType = typeof(global::TUnit.TestProject.Bugs._1594.MyTests), TestMethodName = "Test1", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.ClassDataSourceAttribute() -{Shared = global::TUnit.Core.SharedType.None,} - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] { @@ -42,47 +36,29 @@ internal sealed class TUnit_TestProject_Bugs__1594_MyTests_Test1_TestSource : gl ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1594.MyTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1594.MyTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata + Type = typeof(global::TUnit.TestProject.Bugs._1594.MyTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1594.MyTests)), + Name = "MyTests", + Namespace = "TUnit.TestProject.Bugs._1594", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = new global::TUnit.Core.ParameterMetadata[] { - Type = typeof(global::TUnit.TestProject.Bugs._1594.MyTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1594.MyTests)), - Name = "MyTests", - Namespace = "TUnit.TestProject.Bugs._1594", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = new global::TUnit.Core.ParameterMetadata[] + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Bugs._1594.MyFixture)) { - new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Bugs._1594.MyFixture)) - { - Name = "myFixture", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1594.MyFixture)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1594.MyTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.Bugs._1594.MyFixture) })!.GetParameters()[0] - } - }, - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Name = "myFixture", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1594.MyFixture)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1594.MyTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.Bugs._1594.MyFixture) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.Bugs._1594.MyTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.Test1(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -105,6 +81,32 @@ internal sealed class TUnit_TestProject_Bugs__1594_MyTests_Test1_TestSource : gl Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.ClassDataSourceAttribute() +{Shared = global::TUnit.Core.SharedType.None,} + ]; + } + private static global::TUnit.TestProject.Bugs._1594.MyTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._1594.MyTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1594.MyTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.Test1(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__1594_MyTests_Test1_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1603.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1603.Test.verified.txt index 57ac1a6fac..1de5a70733 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1603.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1603.Test.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_Bugs__1603_Tests_Casted_Integer_To_Short TestClassType = typeof(global::TUnit.TestProject.Bugs._1603.Tests), TestMethodName = "Casted_Integer_To_Short_Converts", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute((short) -123), @@ -48,42 +44,20 @@ internal sealed class TUnit_TestProject_Bugs__1603_Tests_Casted_Integer_To_Short ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1603.Tests).GetMethod("Casted_Integer_To_Short_Converts", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(short) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1603.Tests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1603.Tests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._1603.Tests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1603.Tests)), - Name = "Tests", - Namespace = "TUnit.TestProject.Bugs._1603", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._1603.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1603.Tests)), + Name = "Tests", + Namespace = "TUnit.TestProject.Bugs._1603", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.Bugs._1603.Tests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Casted_Integer_To_Short_Converts(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -106,6 +80,37 @@ internal sealed class TUnit_TestProject_Bugs__1603_Tests_Casted_Integer_To_Short Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.Bugs._1603.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._1603.Tests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1603.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.Casted_Integer_To_Short_Converts(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__1603_Tests_Casted_Integer_To_Short_Converts__short_ModuleInitializer { @@ -136,11 +141,7 @@ internal sealed class TUnit_TestProject_Bugs__1603_Tests_Integer_To_Short_Conver TestClassType = typeof(global::TUnit.TestProject.Bugs._1603.Tests), TestMethodName = "Integer_To_Short_Converts", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(-123), @@ -169,42 +170,20 @@ internal sealed class TUnit_TestProject_Bugs__1603_Tests_Integer_To_Short_Conver ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1603.Tests).GetMethod("Integer_To_Short_Converts", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(short) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1603.Tests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1603.Tests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._1603.Tests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1603.Tests)), - Name = "Tests", - Namespace = "TUnit.TestProject.Bugs._1603", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._1603.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1603.Tests)), + Name = "Tests", + Namespace = "TUnit.TestProject.Bugs._1603", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.Bugs._1603.Tests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Integer_To_Short_Converts(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -227,6 +206,37 @@ internal sealed class TUnit_TestProject_Bugs__1603_Tests_Integer_To_Short_Conver Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.Bugs._1603.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._1603.Tests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1603.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.Integer_To_Short_Converts(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__1603_Tests_Integer_To_Short_Converts__short_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1692.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1692.Test.verified.txt index 61a0b1067d..0fa5ea0460 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1692.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1692.Test.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_Bugs__1692_Tests_NullTest__string__TestS TestClassType = typeof(global::TUnit.TestProject.Bugs._1692.Tests), TestMethodName = "NullTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(null), @@ -49,42 +45,20 @@ internal sealed class TUnit_TestProject_Bugs__1692_Tests_NullTest__string__TestS ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1692.Tests).GetMethod("NullTest", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1692.Tests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1692.Tests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._1692.Tests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1692.Tests)), - Name = "Tests", - Namespace = "TUnit.TestProject.Bugs._1692", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._1692.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1692.Tests)), + Name = "Tests", + Namespace = "TUnit.TestProject.Bugs._1692", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.Bugs._1692.Tests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.NullTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -107,6 +81,37 @@ internal sealed class TUnit_TestProject_Bugs__1692_Tests_NullTest__string__TestS Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.Bugs._1692.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._1692.Tests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1692.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.NullTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__1692_Tests_NullTest__string__ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1821.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1821.Test.verified.txt index 8b7778499a..8095272034 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1821.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1821.Test.verified.txt @@ -15,12 +15,7 @@ internal sealed class TUnit_TestProject_Bugs__1821_Tests_MethodDataSource__strin TestClassType = typeof(global::TUnit.TestProject.Bugs._1821.Tests), TestMethodName = "MethodDataSource", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.ClassDataSourceAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.InstanceMethodDataSourceAttribute("DataSource"), @@ -52,54 +47,29 @@ internal sealed class TUnit_TestProject_Bugs__1821_Tests_MethodDataSource__strin ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1821.Tests).GetMethod("MethodDataSource", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1821.Tests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1821.Tests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata + Type = typeof(global::TUnit.TestProject.Bugs._1821.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1821.Tests)), + Name = "Tests", + Namespace = "TUnit.TestProject.Bugs._1821", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = new global::TUnit.Core.ParameterMetadata[] { - Type = typeof(global::TUnit.TestProject.Bugs._1821.Tests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1821.Tests)), - Name = "Tests", - Namespace = "TUnit.TestProject.Bugs._1821", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = new global::TUnit.Core.ParameterMetadata[] + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Bugs._1821.MyData)) { - new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Bugs._1821.MyData)) - { - Name = "data", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1821.MyData)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1821.Tests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.Bugs._1821.MyData) })!.GetParameters()[0] - } - }, - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Name = "data", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1821.MyData)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1821.Tests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.Bugs._1821.MyData) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.Bugs._1821.Tests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.MethodDataSource(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -122,6 +92,38 @@ internal sealed class TUnit_TestProject_Bugs__1821_Tests_MethodDataSource__strin Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.ClassDataSourceAttribute() + ]; + } + private static global::TUnit.TestProject.Bugs._1821.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._1821.Tests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1821.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.MethodDataSource(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__1821_Tests_MethodDataSource__string_ModuleInitializer { @@ -152,12 +154,7 @@ internal sealed class TUnit_TestProject_Bugs__1821_Tests_MatrixDataSource__strin TestClassType = typeof(global::TUnit.TestProject.Bugs._1821.Tests), TestMethodName = "MatrixDataSource", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.ClassDataSourceAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -189,54 +186,29 @@ internal sealed class TUnit_TestProject_Bugs__1821_Tests_MatrixDataSource__strin ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1821.Tests).GetMethod("MatrixDataSource", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1821.Tests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1821.Tests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata + Type = typeof(global::TUnit.TestProject.Bugs._1821.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1821.Tests)), + Name = "Tests", + Namespace = "TUnit.TestProject.Bugs._1821", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = new global::TUnit.Core.ParameterMetadata[] { - Type = typeof(global::TUnit.TestProject.Bugs._1821.Tests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1821.Tests)), - Name = "Tests", - Namespace = "TUnit.TestProject.Bugs._1821", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = new global::TUnit.Core.ParameterMetadata[] + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Bugs._1821.MyData)) { - new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Bugs._1821.MyData)) - { - Name = "data", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1821.MyData)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1821.Tests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.Bugs._1821.MyData) })!.GetParameters()[0] - } - }, - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Name = "data", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1821.MyData)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1821.Tests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.Bugs._1821.MyData) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.Bugs._1821.Tests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixDataSource(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -259,6 +231,38 @@ internal sealed class TUnit_TestProject_Bugs__1821_Tests_MatrixDataSource__strin Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.ClassDataSourceAttribute() + ]; + } + private static global::TUnit.TestProject.Bugs._1821.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._1821.Tests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1821.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.MatrixDataSource(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__1821_Tests_MatrixDataSource__string_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.DotNet10_0.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.DotNet10_0.verified.txt index 20bb1ed8d1..6786b41edc 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.DotNet10_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.DotNet10_0.verified.txt @@ -15,12 +15,7 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource TestClassType = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), TestMethodName = "Test1", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.InheritsTestsAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -37,35 +32,20 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1889.DerivedTest", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1889.DerivedTest", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest)), - Name = "DerivedTest", - Namespace = "TUnit.TestProject.Bugs._1889", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest)), + Name = "DerivedTest", + Namespace = "TUnit.TestProject.Bugs._1889", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.Bugs._1889.DerivedTest(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.Test1(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -88,6 +68,31 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.InheritsTestsAttribute() + ]; + } + private static global::TUnit.TestProject.Bugs._1889.DerivedTest __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._1889.DerivedTest(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1889.DerivedTest instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.Test1(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__1889_DerivedTest_Test1_ModuleInitializer { @@ -118,12 +123,7 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_TestS TestClassType = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), TestMethodName = "Test2", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.InheritsTestsAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -152,43 +152,20 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_TestS ReflectionInfo = typeof(global::TUnit.TestProject.Library.Bugs._1889.BaseTest).GetMethod("Test2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1889.DerivedTest", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1889.DerivedTest", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest)), - Name = "DerivedTest", - Namespace = "TUnit.TestProject.Bugs._1889", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest)), + Name = "DerivedTest", + Namespace = "TUnit.TestProject.Bugs._1889", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.Bugs._1889.DerivedTest(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.Test2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -211,6 +188,39 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_TestS Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.InheritsTestsAttribute() + ]; + } + private static global::TUnit.TestProject.Bugs._1889.DerivedTest __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._1889.DerivedTest(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1889.DerivedTest instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.Test2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_ModuleInitializer { @@ -241,12 +251,7 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_TestS TestClassType = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), TestMethodName = "Test3", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.InheritsTestsAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(false), @@ -276,43 +281,20 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_TestS ReflectionInfo = typeof(global::TUnit.TestProject.Library.Bugs._1889.BaseTest).GetMethod("Test3", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1889.DerivedTest", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1889.DerivedTest", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest)), - Name = "DerivedTest", - Namespace = "TUnit.TestProject.Bugs._1889", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest)), + Name = "DerivedTest", + Namespace = "TUnit.TestProject.Bugs._1889", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.Bugs._1889.DerivedTest(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.Test3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -335,6 +317,39 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_TestS Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.InheritsTestsAttribute() + ]; + } + private static global::TUnit.TestProject.Bugs._1889.DerivedTest __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._1889.DerivedTest(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1889.DerivedTest instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.Test3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_ModuleInitializer { 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 20bb1ed8d1..6786b41edc 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.DotNet8_0.verified.txt @@ -15,12 +15,7 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource TestClassType = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), TestMethodName = "Test1", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.InheritsTestsAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -37,35 +32,20 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1889.DerivedTest", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1889.DerivedTest", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest)), - Name = "DerivedTest", - Namespace = "TUnit.TestProject.Bugs._1889", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest)), + Name = "DerivedTest", + Namespace = "TUnit.TestProject.Bugs._1889", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.Bugs._1889.DerivedTest(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.Test1(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -88,6 +68,31 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.InheritsTestsAttribute() + ]; + } + private static global::TUnit.TestProject.Bugs._1889.DerivedTest __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._1889.DerivedTest(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1889.DerivedTest instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.Test1(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__1889_DerivedTest_Test1_ModuleInitializer { @@ -118,12 +123,7 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_TestS TestClassType = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), TestMethodName = "Test2", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.InheritsTestsAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -152,43 +152,20 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_TestS ReflectionInfo = typeof(global::TUnit.TestProject.Library.Bugs._1889.BaseTest).GetMethod("Test2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1889.DerivedTest", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1889.DerivedTest", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest)), - Name = "DerivedTest", - Namespace = "TUnit.TestProject.Bugs._1889", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest)), + Name = "DerivedTest", + Namespace = "TUnit.TestProject.Bugs._1889", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.Bugs._1889.DerivedTest(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.Test2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -211,6 +188,39 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_TestS Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.InheritsTestsAttribute() + ]; + } + private static global::TUnit.TestProject.Bugs._1889.DerivedTest __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._1889.DerivedTest(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1889.DerivedTest instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.Test2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_ModuleInitializer { @@ -241,12 +251,7 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_TestS TestClassType = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), TestMethodName = "Test3", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.InheritsTestsAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(false), @@ -276,43 +281,20 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_TestS ReflectionInfo = typeof(global::TUnit.TestProject.Library.Bugs._1889.BaseTest).GetMethod("Test3", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1889.DerivedTest", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1889.DerivedTest", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest)), - Name = "DerivedTest", - Namespace = "TUnit.TestProject.Bugs._1889", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest)), + Name = "DerivedTest", + Namespace = "TUnit.TestProject.Bugs._1889", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.Bugs._1889.DerivedTest(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.Test3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -335,6 +317,39 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_TestS Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.InheritsTestsAttribute() + ]; + } + private static global::TUnit.TestProject.Bugs._1889.DerivedTest __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._1889.DerivedTest(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1889.DerivedTest instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.Test3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_ModuleInitializer { 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 20bb1ed8d1..6786b41edc 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.DotNet9_0.verified.txt @@ -15,12 +15,7 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource TestClassType = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), TestMethodName = "Test1", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.InheritsTestsAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -37,35 +32,20 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1889.DerivedTest", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1889.DerivedTest", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest)), - Name = "DerivedTest", - Namespace = "TUnit.TestProject.Bugs._1889", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest)), + Name = "DerivedTest", + Namespace = "TUnit.TestProject.Bugs._1889", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.Bugs._1889.DerivedTest(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.Test1(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -88,6 +68,31 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.InheritsTestsAttribute() + ]; + } + private static global::TUnit.TestProject.Bugs._1889.DerivedTest __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._1889.DerivedTest(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1889.DerivedTest instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.Test1(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__1889_DerivedTest_Test1_ModuleInitializer { @@ -118,12 +123,7 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_TestS TestClassType = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), TestMethodName = "Test2", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.InheritsTestsAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -152,43 +152,20 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_TestS ReflectionInfo = typeof(global::TUnit.TestProject.Library.Bugs._1889.BaseTest).GetMethod("Test2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1889.DerivedTest", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1889.DerivedTest", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest)), - Name = "DerivedTest", - Namespace = "TUnit.TestProject.Bugs._1889", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest)), + Name = "DerivedTest", + Namespace = "TUnit.TestProject.Bugs._1889", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.Bugs._1889.DerivedTest(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.Test2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -211,6 +188,39 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_TestS Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.InheritsTestsAttribute() + ]; + } + private static global::TUnit.TestProject.Bugs._1889.DerivedTest __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._1889.DerivedTest(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1889.DerivedTest instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.Test2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_ModuleInitializer { @@ -241,12 +251,7 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_TestS TestClassType = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), TestMethodName = "Test3", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.InheritsTestsAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(false), @@ -276,43 +281,20 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_TestS ReflectionInfo = typeof(global::TUnit.TestProject.Library.Bugs._1889.BaseTest).GetMethod("Test3", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1889.DerivedTest", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1889.DerivedTest", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest)), - Name = "DerivedTest", - Namespace = "TUnit.TestProject.Bugs._1889", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest)), + Name = "DerivedTest", + Namespace = "TUnit.TestProject.Bugs._1889", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.Bugs._1889.DerivedTest(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.Test3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -335,6 +317,39 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_TestS Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.InheritsTestsAttribute() + ]; + } + private static global::TUnit.TestProject.Bugs._1889.DerivedTest __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._1889.DerivedTest(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1889.DerivedTest instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.Test3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1899.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1899.Test.verified.txt index e63f1540af..93e2f22195 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1899.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1899.Test.verified.txt @@ -15,12 +15,7 @@ internal sealed class TUnit_TestProject_Bugs__1899_DerivedTest_Test1_TestSource TestClassType = typeof(global::TUnit.TestProject.Bugs._1899.DerivedTest), TestMethodName = "Test1", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.InheritsTestsAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -37,35 +32,20 @@ internal sealed class TUnit_TestProject_Bugs__1899_DerivedTest_Test1_TestSource ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1899.DerivedTest", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1899.DerivedTest", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._1899.DerivedTest), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1899.DerivedTest)), - Name = "DerivedTest", - Namespace = "TUnit.TestProject.Bugs._1899", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._1899.DerivedTest), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1899.DerivedTest)), + Name = "DerivedTest", + Namespace = "TUnit.TestProject.Bugs._1899", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.Bugs._1899.DerivedTest(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.Test1(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -88,6 +68,31 @@ internal sealed class TUnit_TestProject_Bugs__1899_DerivedTest_Test1_TestSource Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.InheritsTestsAttribute() + ]; + } + private static global::TUnit.TestProject.Bugs._1899.DerivedTest __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._1899.DerivedTest(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1899.DerivedTest instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.Test1(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__1899_DerivedTest_Test1_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/Tests2083.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests2083.Test.verified.txt index 84311dc61e..f2ca4ad52e 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests2083.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests2083.Test.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_Bugs__2083_Tests_MyTest__long_TestSource TestClassType = typeof(global::TUnit.TestProject.Bugs._2083.Tests), TestMethodName = "MyTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(0), @@ -53,43 +49,20 @@ internal sealed class TUnit_TestProject_Bugs__2083_Tests_MyTest__long_TestSource ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._2083.Tests).GetMethod("MyTest", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(long) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2083.Tests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2083.Tests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._2083.Tests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2083.Tests)), - Name = "Tests", - Namespace = "TUnit.TestProject.Bugs._2083", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._2083.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2083.Tests)), + Name = "Tests", + Namespace = "TUnit.TestProject.Bugs._2083", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.Bugs._2083.Tests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.MyTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -112,6 +85,38 @@ internal sealed class TUnit_TestProject_Bugs__2083_Tests_MyTest__long_TestSource Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.Bugs._2083.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._2083.Tests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._2083.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.MyTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__2083_Tests_MyTest__long_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/Tests2085.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests2085.Test.verified.txt index 6e228a0596..6936f4b8d2 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests2085.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests2085.Test.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_Bugs__2085_Tests_Double_SpecialConsts__d TestClassType = typeof(global::TUnit.TestProject.Bugs._2085.Tests), TestMethodName = "Double_SpecialConsts", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -48,42 +44,20 @@ internal sealed class TUnit_TestProject_Bugs__2085_Tests_Double_SpecialConsts__d ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._2085.Tests).GetMethod("Double_SpecialConsts", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(double) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2085.Tests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2085.Tests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._2085.Tests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2085.Tests)), - Name = "Tests", - Namespace = "TUnit.TestProject.Bugs._2085", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._2085.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2085.Tests)), + Name = "Tests", + Namespace = "TUnit.TestProject.Bugs._2085", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.Bugs._2085.Tests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Double_SpecialConsts(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -106,6 +80,37 @@ internal sealed class TUnit_TestProject_Bugs__2085_Tests_Double_SpecialConsts__d Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.Bugs._2085.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._2085.Tests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._2085.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.Double_SpecialConsts(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__2085_Tests_Double_SpecialConsts__double_ModuleInitializer { @@ -136,11 +141,7 @@ internal sealed class TUnit_TestProject_Bugs__2085_Tests_Float_SpecialConsts__fl TestClassType = typeof(global::TUnit.TestProject.Bugs._2085.Tests), TestMethodName = "Float_SpecialConsts", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -169,42 +170,20 @@ internal sealed class TUnit_TestProject_Bugs__2085_Tests_Float_SpecialConsts__fl ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._2085.Tests).GetMethod("Float_SpecialConsts", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(float) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2085.Tests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2085.Tests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._2085.Tests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2085.Tests)), - Name = "Tests", - Namespace = "TUnit.TestProject.Bugs._2085", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._2085.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2085.Tests)), + Name = "Tests", + Namespace = "TUnit.TestProject.Bugs._2085", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.Bugs._2085.Tests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Float_SpecialConsts(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -227,6 +206,37 @@ internal sealed class TUnit_TestProject_Bugs__2085_Tests_Float_SpecialConsts__fl Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.Bugs._2085.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._2085.Tests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._2085.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.Float_SpecialConsts(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__2085_Tests_Float_SpecialConsts__float_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/Tests2112.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests2112.Test.verified.txt index cd23e7d64f..fc340e8d8d 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests2112.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests2112.Test.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_Bugs__2112_Tests_Test__int_long___TestSo TestClassType = typeof(global::TUnit.TestProject.Bugs._2112.Tests), TestMethodName = "Test", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(0, 1L), @@ -56,73 +52,20 @@ internal sealed class TUnit_TestProject_Bugs__2112_Tests_Test__int_long___TestSo ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._2112.Tests).GetMethod("Test", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(long[]) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2112.Tests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2112.Tests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._2112.Tests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2112.Tests)), - Name = "Tests", - Namespace = "TUnit.TestProject.Bugs._2112", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._2112.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2112.Tests)), + Name = "Tests", + Namespace = "TUnit.TestProject.Bugs._2112", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.Bugs._2112.Tests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.Test(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[0]); - return default(global::System.Threading.Tasks.ValueTask); - } - case 2: - { - instance.Test(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), (args[1] is null ? null : args[1] is long[] arr ? arr : new long[] { global::TUnit.Core.Helpers.CastHelper.Cast(args[1]) })); - return default(global::System.Threading.Tasks.ValueTask); - } - case 3: - { - instance.Test(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[] { global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]) }); - return default(global::System.Threading.Tasks.ValueTask); - } - case 4: - { - instance.Test(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[] { global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]) }); - return default(global::System.Threading.Tasks.ValueTask); - } - case 5: - { - instance.Test(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[] { global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]), global::TUnit.Core.Helpers.CastHelper.Cast(args[4]) }); - return default(global::System.Threading.Tasks.ValueTask); - } - case 6: - { - instance.Test(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[] { global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]), global::TUnit.Core.Helpers.CastHelper.Cast(args[4]), global::TUnit.Core.Helpers.CastHelper.Cast(args[5]) }); - return default(global::System.Threading.Tasks.ValueTask); - } - case 7: - { - instance.Test(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[] { global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]), global::TUnit.Core.Helpers.CastHelper.Cast(args[4]), global::TUnit.Core.Helpers.CastHelper.Cast(args[5]), global::TUnit.Core.Helpers.CastHelper.Cast(args[6]) }); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected between 1 and 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -145,6 +88,68 @@ internal sealed class TUnit_TestProject_Bugs__2112_Tests_Test__int_long___TestSo Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.Bugs._2112.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._2112.Tests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._2112.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.Test(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[0]); + return default(global::System.Threading.Tasks.ValueTask); + } + case 2: + { + instance.Test(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), (args[1] is null ? null : args[1] is long[] arr ? arr : new long[] { global::TUnit.Core.Helpers.CastHelper.Cast(args[1]) })); + return default(global::System.Threading.Tasks.ValueTask); + } + case 3: + { + instance.Test(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[] { global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]) }); + return default(global::System.Threading.Tasks.ValueTask); + } + case 4: + { + instance.Test(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[] { global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]) }); + return default(global::System.Threading.Tasks.ValueTask); + } + case 5: + { + instance.Test(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[] { global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]), global::TUnit.Core.Helpers.CastHelper.Cast(args[4]) }); + return default(global::System.Threading.Tasks.ValueTask); + } + case 6: + { + instance.Test(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[] { global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]), global::TUnit.Core.Helpers.CastHelper.Cast(args[4]), global::TUnit.Core.Helpers.CastHelper.Cast(args[5]) }); + return default(global::System.Threading.Tasks.ValueTask); + } + case 7: + { + instance.Test(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[] { global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]), global::TUnit.Core.Helpers.CastHelper.Cast(args[4]), global::TUnit.Core.Helpers.CastHelper.Cast(args[5]), global::TUnit.Core.Helpers.CastHelper.Cast(args[6]) }); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected between 1 and 2 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__2112_Tests_Test__int_long___ModuleInitializer { @@ -175,11 +180,7 @@ internal sealed class TUnit_TestProject_Bugs__2112_Tests_Test2__int_long___TestS TestClassType = typeof(global::TUnit.TestProject.Bugs._2112.Tests), TestMethodName = "Test2", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(0, 1L, 2L, 3L), @@ -216,73 +217,20 @@ internal sealed class TUnit_TestProject_Bugs__2112_Tests_Test2__int_long___TestS ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._2112.Tests).GetMethod("Test2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(long[]) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2112.Tests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2112.Tests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._2112.Tests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2112.Tests)), - Name = "Tests", - Namespace = "TUnit.TestProject.Bugs._2112", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._2112.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2112.Tests)), + Name = "Tests", + Namespace = "TUnit.TestProject.Bugs._2112", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.Bugs._2112.Tests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 1: - { - instance.Test2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[0]); - return default(global::System.Threading.Tasks.ValueTask); - } - case 2: - { - instance.Test2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), (args[1] is null ? null : args[1] is long[] arr ? arr : new long[] { global::TUnit.Core.Helpers.CastHelper.Cast(args[1]) })); - return default(global::System.Threading.Tasks.ValueTask); - } - case 3: - { - instance.Test2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[] { global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]) }); - return default(global::System.Threading.Tasks.ValueTask); - } - case 4: - { - instance.Test2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[] { global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]) }); - return default(global::System.Threading.Tasks.ValueTask); - } - case 5: - { - instance.Test2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[] { global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]), global::TUnit.Core.Helpers.CastHelper.Cast(args[4]) }); - return default(global::System.Threading.Tasks.ValueTask); - } - case 6: - { - instance.Test2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[] { global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]), global::TUnit.Core.Helpers.CastHelper.Cast(args[4]), global::TUnit.Core.Helpers.CastHelper.Cast(args[5]) }); - return default(global::System.Threading.Tasks.ValueTask); - } - case 7: - { - instance.Test2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[] { global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]), global::TUnit.Core.Helpers.CastHelper.Cast(args[4]), global::TUnit.Core.Helpers.CastHelper.Cast(args[5]), global::TUnit.Core.Helpers.CastHelper.Cast(args[6]) }); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected between 1 and 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -305,6 +253,68 @@ internal sealed class TUnit_TestProject_Bugs__2112_Tests_Test2__int_long___TestS Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.Bugs._2112.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._2112.Tests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._2112.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.Test2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[0]); + return default(global::System.Threading.Tasks.ValueTask); + } + case 2: + { + instance.Test2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), (args[1] is null ? null : args[1] is long[] arr ? arr : new long[] { global::TUnit.Core.Helpers.CastHelper.Cast(args[1]) })); + return default(global::System.Threading.Tasks.ValueTask); + } + case 3: + { + instance.Test2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[] { global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]) }); + return default(global::System.Threading.Tasks.ValueTask); + } + case 4: + { + instance.Test2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[] { global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]) }); + return default(global::System.Threading.Tasks.ValueTask); + } + case 5: + { + instance.Test2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[] { global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]), global::TUnit.Core.Helpers.CastHelper.Cast(args[4]) }); + return default(global::System.Threading.Tasks.ValueTask); + } + case 6: + { + instance.Test2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[] { global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]), global::TUnit.Core.Helpers.CastHelper.Cast(args[4]), global::TUnit.Core.Helpers.CastHelper.Cast(args[5]) }); + return default(global::System.Threading.Tasks.ValueTask); + } + case 7: + { + instance.Test2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), new long[] { global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]), global::TUnit.Core.Helpers.CastHelper.Cast(args[4]), global::TUnit.Core.Helpers.CastHelper.Cast(args[5]), global::TUnit.Core.Helpers.CastHelper.Cast(args[6]) }); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected between 1 and 2 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_Bugs__2112_Tests_Test2__int_long___ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/Tests2136.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests2136.Test.verified.txt index 131dfbecc2..aba4157dc3 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests2136.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests2136.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -54,20 +54,16 @@ internal sealed class TUnit_TestProject_Bugs__2136_Tests_GenericArgumentsTest__T ReflectionInfo = global::System.Linq.Enumerable.FirstOrDefault(typeof(global::TUnit.TestProject.Bugs._2136.Tests).GetMethods(global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance | global::System.Reflection.BindingFlags.Static), m => m.Name == "GenericArgumentsTest" && m.GetParameters().Length == 2)?.GetParameters()[1]! } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2136.Tests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2136.Tests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._2136.Tests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2136.Tests)), - Name = "Tests", - Namespace = "TUnit.TestProject.Bugs._2136", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._2136.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2136.Tests)), + Name = "Tests", + Namespace = "TUnit.TestProject.Bugs._2136", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -126,20 +122,16 @@ internal sealed class TUnit_TestProject_Bugs__2136_Tests_GenericArgumentsTest__T ReflectionInfo = global::System.Linq.Enumerable.FirstOrDefault(typeof(global::TUnit.TestProject.Bugs._2136.Tests).GetMethods(global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance | global::System.Reflection.BindingFlags.Static), m => m.Name == "GenericArgumentsTest" && m.GetParameters().Length == 2)?.GetParameters()[1]! } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2136.Tests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2136.Tests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._2136.Tests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2136.Tests)), - Name = "Tests", - Namespace = "TUnit.TestProject.Bugs._2136", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._2136.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2136.Tests)), + Name = "Tests", + Namespace = "TUnit.TestProject.Bugs._2136", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -210,20 +202,16 @@ internal sealed class TUnit_TestProject_Bugs__2136_Tests_GenericArgumentsTest__T ReflectionInfo = global::System.Linq.Enumerable.FirstOrDefault(typeof(global::TUnit.TestProject.Bugs._2136.Tests).GetMethods(global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance | global::System.Reflection.BindingFlags.Static), m => m.Name == "GenericArgumentsTest" && m.GetParameters().Length == 2)?.GetParameters()[1]! } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2136.Tests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2136.Tests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._2136.Tests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2136.Tests)), - Name = "Tests", - Namespace = "TUnit.TestProject.Bugs._2136", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._2136.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2136.Tests)), + Name = "Tests", + Namespace = "TUnit.TestProject.Bugs._2136", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -294,20 +282,16 @@ internal sealed class TUnit_TestProject_Bugs__2136_Tests_GenericArgumentsTest__T ReflectionInfo = global::System.Linq.Enumerable.FirstOrDefault(typeof(global::TUnit.TestProject.Bugs._2136.Tests).GetMethods(global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance | global::System.Reflection.BindingFlags.Static), m => m.Name == "GenericArgumentsTest" && m.GetParameters().Length == 2)?.GetParameters()[1]! } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2136.Tests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2136.Tests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._2136.Tests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2136.Tests)), - Name = "Tests", - Namespace = "TUnit.TestProject.Bugs._2136", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._2136.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2136.Tests)), + Name = "Tests", + Namespace = "TUnit.TestProject.Bugs._2136", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -378,20 +362,16 @@ internal sealed class TUnit_TestProject_Bugs__2136_Tests_GenericArgumentsTest__T ReflectionInfo = global::System.Linq.Enumerable.FirstOrDefault(typeof(global::TUnit.TestProject.Bugs._2136.Tests).GetMethods(global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance | global::System.Reflection.BindingFlags.Static), m => m.Name == "GenericArgumentsTest" && m.GetParameters().Length == 2)?.GetParameters()[1]! } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2136.Tests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2136.Tests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._2136.Tests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2136.Tests)), - Name = "Tests", - Namespace = "TUnit.TestProject.Bugs._2136", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._2136.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2136.Tests)), + Name = "Tests", + Namespace = "TUnit.TestProject.Bugs._2136", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => @@ -462,20 +442,16 @@ internal sealed class TUnit_TestProject_Bugs__2136_Tests_GenericArgumentsTest__T ReflectionInfo = global::System.Linq.Enumerable.FirstOrDefault(typeof(global::TUnit.TestProject.Bugs._2136.Tests).GetMethods(global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance | global::System.Reflection.BindingFlags.Static), m => m.Name == "GenericArgumentsTest" && m.GetParameters().Length == 2)?.GetParameters()[1]! } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2136.Tests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2136.Tests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._2136.Tests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2136.Tests)), - Name = "Tests", - Namespace = "TUnit.TestProject.Bugs._2136", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.Bugs._2136.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2136.Tests)), + Name = "Tests", + Namespace = "TUnit.TestProject.Bugs._2136", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, InstanceFactory = static (typeArgs, args) => diff --git a/TUnit.Core.SourceGenerator.Tests/TimeoutCancellationTokenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/TimeoutCancellationTokenTests.Test.verified.txt index bb9d5662f0..41afd0d05c 100644 --- a/TUnit.Core.SourceGenerator.Tests/TimeoutCancellationTokenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/TimeoutCancellationTokenTests.Test.verified.txt @@ -15,13 +15,7 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_DefaultTes TestClassType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), TestMethodName = "DefaultTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.MethodDataSourceAttribute("DataSource"), - new global::TUnit.Core.CategoryAttribute("Timeout Cancellation Token Tests") - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] { @@ -71,46 +65,29 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_DefaultTes ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("DefaultTest", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TimeoutCancellationTokenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TimeoutCancellationTokenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata + Type = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests)), + Name = "TimeoutCancellationTokenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = new global::TUnit.Core.ParameterMetadata[] { - Type = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests)), - Name = "TimeoutCancellationTokenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = new global::TUnit.Core.ParameterMetadata[] + new global::TUnit.Core.ParameterMetadata(typeof(int)) { - new global::TUnit.Core.ParameterMetadata(typeof(int)) - { - Name = "value", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0] - } - }, - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.TimeoutCancellationTokenTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.DefaultTest(cancellationToken)); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -133,6 +110,31 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_DefaultTes Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.MethodDataSourceAttribute("DataSource"), + new global::TUnit.Core.CategoryAttribute("Timeout Cancellation Token Tests") + ]; + } + private static global::TUnit.TestProject.TimeoutCancellationTokenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.TimeoutCancellationTokenTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.TimeoutCancellationTokenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.DefaultTest(cancellationToken)); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_TimeoutCancellationTokenTests_DefaultTest__CancellationToken_ModuleInitializer { @@ -163,15 +165,7 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_BasicTest_ TestClassType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), TestMethodName = "BasicTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.TimeoutAttribute(5_000), - new global::TUnit.Core.CategoryAttribute("Blah"), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Failure), - new global::TUnit.Core.MethodDataSourceAttribute("DataSource"), - new global::TUnit.Core.CategoryAttribute("Timeout Cancellation Token Tests") - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] { @@ -221,46 +215,29 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_BasicTest_ ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("BasicTest", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TimeoutCancellationTokenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TimeoutCancellationTokenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata + Type = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests)), + Name = "TimeoutCancellationTokenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = new global::TUnit.Core.ParameterMetadata[] { - Type = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests)), - Name = "TimeoutCancellationTokenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = new global::TUnit.Core.ParameterMetadata[] + new global::TUnit.Core.ParameterMetadata(typeof(int)) { - new global::TUnit.Core.ParameterMetadata(typeof(int)) - { - Name = "value", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0] - } - }, - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.TimeoutCancellationTokenTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.BasicTest(cancellationToken)); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -283,6 +260,33 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_BasicTest_ Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.TimeoutAttribute(5_000), + new global::TUnit.Core.CategoryAttribute("Blah"), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Failure), + new global::TUnit.Core.MethodDataSourceAttribute("DataSource"), + new global::TUnit.Core.CategoryAttribute("Timeout Cancellation Token Tests") + ]; + } + private static global::TUnit.TestProject.TimeoutCancellationTokenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.TimeoutCancellationTokenTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.TimeoutCancellationTokenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.BasicTest(cancellationToken)); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_TimeoutCancellationTokenTests_BasicTest__CancellationToken_ModuleInitializer { @@ -313,14 +317,7 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_InheritedT TestClassType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), TestMethodName = "InheritedTimeoutAttribute", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.TimeoutCancellationTokenTests.FiveSecondTimeout(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Failure), - new global::TUnit.Core.MethodDataSourceAttribute("DataSource"), - new global::TUnit.Core.CategoryAttribute("Timeout Cancellation Token Tests") - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] { @@ -370,46 +367,29 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_InheritedT ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("InheritedTimeoutAttribute", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TimeoutCancellationTokenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TimeoutCancellationTokenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata + Type = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests)), + Name = "TimeoutCancellationTokenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = new global::TUnit.Core.ParameterMetadata[] { - Type = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests)), - Name = "TimeoutCancellationTokenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = new global::TUnit.Core.ParameterMetadata[] + new global::TUnit.Core.ParameterMetadata(typeof(int)) { - new global::TUnit.Core.ParameterMetadata(typeof(int)) - { - Name = "value", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0] - } - }, - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.TimeoutCancellationTokenTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.InheritedTimeoutAttribute(cancellationToken)); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -432,6 +412,32 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_InheritedT Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.TimeoutCancellationTokenTests.FiveSecondTimeout(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Failure), + new global::TUnit.Core.MethodDataSourceAttribute("DataSource"), + new global::TUnit.Core.CategoryAttribute("Timeout Cancellation Token Tests") + ]; + } + private static global::TUnit.TestProject.TimeoutCancellationTokenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.TimeoutCancellationTokenTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.TimeoutCancellationTokenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.InheritedTimeoutAttribute(cancellationToken)); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_TimeoutCancellationTokenTests_InheritedTimeoutAttribute__CancellationToken_ModuleInitializer { @@ -462,14 +468,7 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_DataTest__ TestClassType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), TestMethodName = "DataTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.TimeoutAttribute(5_000), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Failure), - new global::TUnit.Core.MethodDataSourceAttribute("DataSource"), - new global::TUnit.Core.CategoryAttribute("Timeout Cancellation Token Tests") - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1), @@ -529,55 +528,29 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_DataTest__ ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("DataTest", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TimeoutCancellationTokenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TimeoutCancellationTokenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata + Type = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests)), + Name = "TimeoutCancellationTokenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = new global::TUnit.Core.ParameterMetadata[] { - Type = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests)), - Name = "TimeoutCancellationTokenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = new global::TUnit.Core.ParameterMetadata[] + new global::TUnit.Core.ParameterMetadata(typeof(int)) { - new global::TUnit.Core.ParameterMetadata(typeof(int)) - { - Name = "value", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0] - } - }, - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.TimeoutCancellationTokenTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var context = global::TUnit.Core.TestContext.Current; - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.DataTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), context?.Execution.CancellationToken ?? global::System.Threading.CancellationToken.None)); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -600,6 +573,41 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_DataTest__ Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.TimeoutAttribute(5_000), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Failure), + new global::TUnit.Core.MethodDataSourceAttribute("DataSource"), + new global::TUnit.Core.CategoryAttribute("Timeout Cancellation Token Tests") + ]; + } + private static global::TUnit.TestProject.TimeoutCancellationTokenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.TimeoutCancellationTokenTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.TimeoutCancellationTokenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + var context = global::TUnit.Core.TestContext.Current; + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.DataTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), context?.Execution.CancellationToken ?? global::System.Threading.CancellationToken.None)); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_TimeoutCancellationTokenTests_DataTest__int_CancellationToken_ModuleInitializer { @@ -630,14 +638,7 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_DataSource TestClassType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), TestMethodName = "DataSourceTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TimeoutAttribute(5_000), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Failure), - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.MethodDataSourceAttribute("DataSource"), - new global::TUnit.Core.CategoryAttribute("Timeout Cancellation Token Tests") - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("DataSource") @@ -718,55 +719,29 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_DataSource ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("DataSourceTest", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TimeoutCancellationTokenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TimeoutCancellationTokenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata + Type = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests)), + Name = "TimeoutCancellationTokenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = new global::TUnit.Core.ParameterMetadata[] { - Type = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests)), - Name = "TimeoutCancellationTokenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = new global::TUnit.Core.ParameterMetadata[] + new global::TUnit.Core.ParameterMetadata(typeof(int)) { - new global::TUnit.Core.ParameterMetadata(typeof(int)) - { - Name = "value", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0] - } - }, - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.TimeoutCancellationTokenTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var context = global::TUnit.Core.TestContext.Current; - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.DataSourceTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), context?.Execution.CancellationToken ?? global::System.Threading.CancellationToken.None)); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -789,6 +764,41 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_DataSource Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TimeoutAttribute(5_000), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Failure), + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.MethodDataSourceAttribute("DataSource"), + new global::TUnit.Core.CategoryAttribute("Timeout Cancellation Token Tests") + ]; + } + private static global::TUnit.TestProject.TimeoutCancellationTokenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.TimeoutCancellationTokenTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.TimeoutCancellationTokenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + var context = global::TUnit.Core.TestContext.Current; + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.DataSourceTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), context?.Execution.CancellationToken ?? global::System.Threading.CancellationToken.None)); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_TimeoutCancellationTokenTests_DataSourceTest__int_CancellationToken_ModuleInitializer { @@ -819,15 +829,7 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_MatrixTest TestClassType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), TestMethodName = "MatrixTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.TimeoutAttribute(5_000), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Failure), - new global::TUnit.Core.CategoryAttribute("Blah"), - new global::TUnit.Core.MethodDataSourceAttribute("DataSource"), - new global::TUnit.Core.CategoryAttribute("Timeout Cancellation Token Tests") - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -887,55 +889,29 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_MatrixTest ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("MatrixTest", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[1] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TimeoutCancellationTokenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TimeoutCancellationTokenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata + Type = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests)), + Name = "TimeoutCancellationTokenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = new global::TUnit.Core.ParameterMetadata[] { - Type = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests)), - Name = "TimeoutCancellationTokenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = new global::TUnit.Core.ParameterMetadata[] + new global::TUnit.Core.ParameterMetadata(typeof(int)) { - new global::TUnit.Core.ParameterMetadata(typeof(int)) - { - Name = "value", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0] - } - }, - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.TimeoutCancellationTokenTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var context = global::TUnit.Core.TestContext.Current; - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), context?.Execution.CancellationToken ?? global::System.Threading.CancellationToken.None)); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -958,6 +934,42 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_MatrixTest Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.TimeoutAttribute(5_000), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Failure), + new global::TUnit.Core.CategoryAttribute("Blah"), + new global::TUnit.Core.MethodDataSourceAttribute("DataSource"), + new global::TUnit.Core.CategoryAttribute("Timeout Cancellation Token Tests") + ]; + } + private static global::TUnit.TestProject.TimeoutCancellationTokenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.TimeoutCancellationTokenTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.TimeoutCancellationTokenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + var context = global::TUnit.Core.TestContext.Current; + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), context?.Execution.CancellationToken ?? global::System.Threading.CancellationToken.None)); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_TimeoutCancellationTokenTests_MatrixTest__int_CancellationToken_ModuleInitializer { @@ -988,14 +1000,7 @@ internal sealed class TUnit_TestProject_TimeoutDoesNotFireTests_QuickTestDoesNot TestClassType = typeof(global::TUnit.TestProject.TimeoutDoesNotFireTests), TestMethodName = "QuickTestDoesNotTimeout", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.MethodDataSourceAttribute("DataSource"), - new global::TUnit.Core.TimeoutAttribute(30_000), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.CategoryAttribute("Timeout Cancellation Token Tests") - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] { @@ -1045,46 +1050,29 @@ internal sealed class TUnit_TestProject_TimeoutDoesNotFireTests_QuickTestDoesNot ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutDoesNotFireTests).GetMethod("QuickTestDoesNotTimeout", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TimeoutDoesNotFireTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TimeoutDoesNotFireTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata + Type = typeof(global::TUnit.TestProject.TimeoutDoesNotFireTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TimeoutDoesNotFireTests)), + Name = "TimeoutDoesNotFireTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = new global::TUnit.Core.ParameterMetadata[] { - Type = typeof(global::TUnit.TestProject.TimeoutDoesNotFireTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TimeoutDoesNotFireTests)), - Name = "TimeoutDoesNotFireTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = new global::TUnit.Core.ParameterMetadata[] + new global::TUnit.Core.ParameterMetadata(typeof(int)) { - new global::TUnit.Core.ParameterMetadata(typeof(int)) - { - Name = "value", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutDoesNotFireTests).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0] - } - }, - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutDoesNotFireTests).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.TimeoutDoesNotFireTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.QuickTestDoesNotTimeout(cancellationToken)); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1107,6 +1095,32 @@ internal sealed class TUnit_TestProject_TimeoutDoesNotFireTests_QuickTestDoesNot Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.MethodDataSourceAttribute("DataSource"), + new global::TUnit.Core.TimeoutAttribute(30_000), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.CategoryAttribute("Timeout Cancellation Token Tests") + ]; + } + private static global::TUnit.TestProject.TimeoutDoesNotFireTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.TimeoutDoesNotFireTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.TimeoutDoesNotFireTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.QuickTestDoesNotTimeout(cancellationToken)); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_TimeoutDoesNotFireTests_QuickTestDoesNotTimeout__CancellationToken_ModuleInitializer { @@ -1137,14 +1151,7 @@ internal sealed class TUnit_TestProject_CancellationTokenTriggeredTests_Cancella TestClassType = typeof(global::TUnit.TestProject.CancellationTokenTriggeredTests), TestMethodName = "CancellationTokenIsTriggered", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.MethodDataSourceAttribute("DataSource"), - new global::TUnit.Core.TimeoutAttribute(5_000), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Failure), - new global::TUnit.Core.CategoryAttribute("Timeout Cancellation Token Tests") - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] { @@ -1194,46 +1201,29 @@ internal sealed class TUnit_TestProject_CancellationTokenTriggeredTests_Cancella ReflectionInfo = typeof(global::TUnit.TestProject.CancellationTokenTriggeredTests).GetMethod("CancellationTokenIsTriggered", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.CancellationTokenTriggeredTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.CancellationTokenTriggeredTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata + Type = typeof(global::TUnit.TestProject.CancellationTokenTriggeredTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.CancellationTokenTriggeredTests)), + Name = "CancellationTokenTriggeredTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = new global::TUnit.Core.ParameterMetadata[] { - Type = typeof(global::TUnit.TestProject.CancellationTokenTriggeredTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.CancellationTokenTriggeredTests)), - Name = "CancellationTokenTriggeredTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = new global::TUnit.Core.ParameterMetadata[] + new global::TUnit.Core.ParameterMetadata(typeof(int)) { - new global::TUnit.Core.ParameterMetadata(typeof(int)) - { - Name = "value", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.CancellationTokenTriggeredTests).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0] - } - }, - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.CancellationTokenTriggeredTests).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.CancellationTokenTriggeredTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.CancellationTokenIsTriggered(cancellationToken)); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -1256,6 +1246,32 @@ internal sealed class TUnit_TestProject_CancellationTokenTriggeredTests_Cancella Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.MethodDataSourceAttribute("DataSource"), + new global::TUnit.Core.TimeoutAttribute(5_000), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Failure), + new global::TUnit.Core.CategoryAttribute("Timeout Cancellation Token Tests") + ]; + } + private static global::TUnit.TestProject.CancellationTokenTriggeredTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.CancellationTokenTriggeredTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.CancellationTokenTriggeredTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.CancellationTokenIsTriggered(cancellationToken)); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_CancellationTokenTriggeredTests_CancellationTokenIsTriggered__Cancel_38B13F70_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/TupleDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/TupleDataSourceDrivenTests.Test.verified.txt index 80318b84bc..b922af14dc 100644 --- a/TUnit.Core.SourceGenerator.Tests/TupleDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/TupleDataSourceDrivenTests.Test.verified.txt @@ -15,11 +15,7 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu TestClassType = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), TestMethodName = "DataSource_TupleMethod", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") @@ -73,43 +69,20 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu ReflectionInfo = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string), typeof(bool) }, null)!.GetParameters()[2] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TupleDataSourceDrivenTests", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TupleDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests)), - Name = "TupleDataSourceDrivenTests", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", static () => new global::TUnit.Core.AssemblyMetadata { Name = "TestsBase`1" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests)), + Name = "TupleDataSourceDrivenTests", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.TupleDataSourceDrivenTests(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 3: - { - instance.DataSource_TupleMethod(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -132,6 +105,38 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + private static global::TUnit.TestProject.TupleDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.TupleDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.TupleDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 3: + { + instance.DataSource_TupleMethod(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_TupleMethod__int_string_bool_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_AotSafeDataSourceFactories.verified.txt b/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_AotSafeDataSourceFactories.verified.txt index f975995e9d..2d39e5f4e3 100644 --- a/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_AotSafeDataSourceFactories.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_AotSafeDataSourceFactories.verified.txt @@ -15,10 +15,7 @@ internal sealed class TUnit_TestProject_AotDataSourceTest_TestWithDataSource__in TestClassType = typeof(global::TUnit.TestProject.AotDataSourceTest), TestMethodName = "TestWithDataSource", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1, 2, 3), @@ -62,43 +59,20 @@ internal sealed class TUnit_TestProject_AotDataSourceTest_TestWithDataSource__in ReflectionInfo = typeof(global::TUnit.TestProject.AotDataSourceTest).GetMethod("TestWithDataSource", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int), typeof(int) }, null)!.GetParameters()[2] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("UnifiedReflectionFreeTests:global::TUnit.TestProject.AotDataSourceTest", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("UnifiedReflectionFreeTests:global::TUnit.TestProject.AotDataSourceTest", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.AotDataSourceTest), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AotDataSourceTest)), - Name = "AotDataSourceTest", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("UnifiedReflectionFreeTests", static () => new global::TUnit.Core.AssemblyMetadata { Name = "UnifiedReflectionFreeTests" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.AotDataSourceTest), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AotDataSourceTest)), + Name = "AotDataSourceTest", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("UnifiedReflectionFreeTests", "UnifiedReflectionFreeTests"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.AotDataSourceTest(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - switch (args.Length) - { - case 3: - { - instance.TestWithDataSource(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -121,6 +95,37 @@ internal sealed class TUnit_TestProject_AotDataSourceTest_TestWithDataSource__in Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.AotDataSourceTest __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.AotDataSourceTest(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AotDataSourceTest instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 3: + { + instance.TestWithDataSource(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_AotDataSourceTest_TestWithDataSource__int_int_int_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_ConfigurationSupport.verified.txt b/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_ConfigurationSupport.verified.txt index 9cd5a28a5a..9bfcf8090a 100644 --- a/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_ConfigurationSupport.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_ConfigurationSupport.verified.txt @@ -15,10 +15,7 @@ internal sealed class TUnit_TestProject_ConfigurationTest_TestWithConfiguration_ TestClassType = typeof(global::TUnit.TestProject.ConfigurationTest), TestMethodName = "TestWithConfiguration", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -35,35 +32,20 @@ internal sealed class TUnit_TestProject_ConfigurationTest_TestWithConfiguration_ ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("UnifiedReflectionFreeTests:global::TUnit.TestProject.ConfigurationTest", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("UnifiedReflectionFreeTests:global::TUnit.TestProject.ConfigurationTest", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.ConfigurationTest), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ConfigurationTest)), - Name = "ConfigurationTest", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("UnifiedReflectionFreeTests", static () => new global::TUnit.Core.AssemblyMetadata { Name = "UnifiedReflectionFreeTests" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.ConfigurationTest), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ConfigurationTest)), + Name = "ConfigurationTest", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("UnifiedReflectionFreeTests", "UnifiedReflectionFreeTests"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.ConfigurationTest(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.TestWithConfiguration(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -86,6 +68,29 @@ internal sealed class TUnit_TestProject_ConfigurationTest_TestWithConfiguration_ Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.ConfigurationTest __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.ConfigurationTest(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ConfigurationTest instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.TestWithConfiguration(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_ConfigurationTest_TestWithConfiguration_ModuleInitializer { 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 151de011a0..6ae76bb395 100644 --- a/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_ModuleInitializer_Generation.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_ModuleInitializer_Generation.verified.txt @@ -15,10 +15,7 @@ internal sealed class TUnit_TestProject_ModuleInitializerTest_TestWithModuleInit TestClassType = typeof(global::TUnit.TestProject.ModuleInitializerTest), TestMethodName = "TestWithModuleInit", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -35,35 +32,20 @@ internal sealed class TUnit_TestProject_ModuleInitializerTest_TestWithModuleInit ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("UnifiedReflectionFreeTests:global::TUnit.TestProject.ModuleInitializerTest", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("UnifiedReflectionFreeTests:global::TUnit.TestProject.ModuleInitializerTest", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.ModuleInitializerTest), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ModuleInitializerTest)), - Name = "ModuleInitializerTest", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("UnifiedReflectionFreeTests", static () => new global::TUnit.Core.AssemblyMetadata { Name = "UnifiedReflectionFreeTests" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.ModuleInitializerTest), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ModuleInitializerTest)), + Name = "ModuleInitializerTest", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("UnifiedReflectionFreeTests", "UnifiedReflectionFreeTests"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.ModuleInitializerTest(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.TestWithModuleInit(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -86,6 +68,29 @@ internal sealed class TUnit_TestProject_ModuleInitializerTest_TestWithModuleInit Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.ModuleInitializerTest __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.ModuleInitializerTest(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ModuleInitializerTest instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.TestWithModuleInit(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_ModuleInitializerTest_TestWithModuleInit_ModuleInitializer { 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 17a944edf6..af82188332 100644 --- a/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_StronglyTypedDelegates_Generation.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_StronglyTypedDelegates_Generation.verified.txt @@ -15,10 +15,7 @@ internal sealed class TUnit_TestProject_TypedDelegateTest_TestWithDelegate_TestS TestClassType = typeof(global::TUnit.TestProject.TypedDelegateTest), TestMethodName = "TestWithDelegate", Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute() - ], + AttributeFactory = __CreateAttributes, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -35,35 +32,20 @@ internal sealed class TUnit_TestProject_TypedDelegateTest_TestWithDelegate_TestS ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("UnifiedReflectionFreeTests:global::TUnit.TestProject.TypedDelegateTest", static () => + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("UnifiedReflectionFreeTests:global::TUnit.TestProject.TypedDelegateTest", new global::TUnit.Core.ClassMetadata { - var classMetadata = new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.TypedDelegateTest), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TypedDelegateTest)), - Name = "TypedDelegateTest", - Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("UnifiedReflectionFreeTests", static () => new global::TUnit.Core.AssemblyMetadata { Name = "UnifiedReflectionFreeTests" }), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }; - return classMetadata; + Type = typeof(global::TUnit.TestProject.TypedDelegateTest), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TypedDelegateTest)), + Name = "TypedDelegateTest", + Namespace = "TUnit.TestProject", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("UnifiedReflectionFreeTests", "UnifiedReflectionFreeTests"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null }) }, - InstanceFactory = static (typeArgs, args) => new global::TUnit.TestProject.TypedDelegateTest(), - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - instance.TestWithDelegate(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - }, + InstanceFactory = __CreateInstance, + InvokeTypedTest = __InvokeTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; @@ -86,6 +68,29 @@ internal sealed class TUnit_TestProject_TypedDelegateTest_TestWithDelegate_TestS Materializer = GetTests }; } + private static global::System.Attribute[] __CreateAttributes() + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + private static global::TUnit.TestProject.TypedDelegateTest __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.TypedDelegateTest(); + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.TypedDelegateTest instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.TestWithDelegate(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } } internal static class TUnit_TestProject_TypedDelegateTest_TestWithDelegate_ModuleInitializer { diff --git a/TUnit.Core.SourceGenerator/CodeGenerators/Helpers/InstanceFactoryGenerator.cs b/TUnit.Core.SourceGenerator/CodeGenerators/Helpers/InstanceFactoryGenerator.cs index 19e041f38b..e90f1b336c 100644 --- a/TUnit.Core.SourceGenerator/CodeGenerators/Helpers/InstanceFactoryGenerator.cs +++ b/TUnit.Core.SourceGenerator/CodeGenerators/Helpers/InstanceFactoryGenerator.cs @@ -31,12 +31,17 @@ public static void GenerateClassConstructorStub(CodeWriter writer) writer.AppendLine("InstanceFactory = static (typeArgs, args) =>"); writer.AppendLine("{"); writer.Indent(); - writer.AppendLine("// ClassConstructor attribute is present - instance creation handled at runtime"); - writer.AppendLine("throw new global::System.NotSupportedException(\"Instance creation for classes with ClassConstructor attribute is handled at runtime\");"); + GenerateClassConstructorStubBody(writer); writer.Unindent(); writer.AppendLine("},"); } + private static void GenerateClassConstructorStubBody(CodeWriter writer) + { + writer.AppendLine("// ClassConstructor attribute is present - instance creation handled at runtime"); + writer.AppendLine("throw new global::System.NotSupportedException(\"Instance creation for classes with ClassConstructor attribute is handled at runtime\");"); + } + /// /// Generates code to create an instance of a type with proper required property handling. /// This handles required properties that don't have data sources by initializing them with defaults. @@ -131,6 +136,63 @@ public static void GenerateInstanceFactory(CodeWriter writer, ITypeSymbol typeSy } } + /// + /// Generates the InstanceFactory as a named static method instead of a lambda, + /// to avoid generating a <>c display class. + /// + public static void GenerateInstanceFactoryAsMethod(CodeWriter writer, ITypeSymbol typeSymbol) + { + var className = typeSymbol.GloballyQualified(); + + writer.AppendLine($"private static {className} __CreateInstance(global::System.Type[] typeArgs, object?[] args)"); + writer.AppendLine("{"); + writer.Indent(); + + if (typeSymbol is INamedTypeSymbol namedTypeSymbol && HasClassConstructorAttribute(namedTypeSymbol)) + { + GenerateClassConstructorStubBody(writer); + } + else if (typeSymbol.HasParameterizedConstructor()) + { + var constructor = GetPrimaryConstructor(typeSymbol); + if (constructor != null) + { + GenerateTypedConstructorCallBody(writer, className, constructor); + } + else + { + writer.AppendLine("return null!;"); + } + } + else + { + var requiredProperties = RequiredPropertyHelper.GetAllRequiredProperties(typeSymbol); + + if (!requiredProperties.Any()) + { + writer.AppendLine($"return new {className}();"); + } + else + { + writer.AppendLine($"return new {className}()"); + writer.AppendLine("{"); + writer.Indent(); + + foreach (var property in requiredProperties) + { + var defaultValue = RequiredPropertyHelper.GetDefaultValueForType(property.Type); + writer.AppendLine($"{property.Name} = {defaultValue},"); + } + + writer.Unindent(); + writer.AppendLine("};"); + } + } + + writer.Unindent(); + writer.AppendLine("}"); + } + private static IMethodSymbol? GetPrimaryConstructor(ITypeSymbol typeSymbol) { // Materialize constructors once to avoid multiple enumerations @@ -166,7 +228,13 @@ private static void GenerateTypedConstructorCall(CodeWriter writer, string class writer.AppendLine("InstanceFactory = static (typeArgs, args) =>"); writer.AppendLine("{"); writer.Indent(); + GenerateTypedConstructorCallBody(writer, className, constructor); + writer.Unindent(); + writer.AppendLine("},"); + } + private static void GenerateTypedConstructorCallBody(CodeWriter writer, string className, IMethodSymbol constructor) + { // Check for required properties var requiredProperties = RequiredPropertyHelper.GetAllRequiredProperties(constructor.ContainingType); @@ -216,9 +284,6 @@ private static void GenerateTypedConstructorCall(CodeWriter writer, string class writer.AppendLine(";"); } - - writer.Unindent(); - writer.AppendLine("},"); } private static void GenerateGenericInstanceFactory(CodeWriter writer, INamedTypeSymbol genericType) diff --git a/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs b/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs index 73702998d6..e0632f10ed 100644 --- a/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs +++ b/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs @@ -381,7 +381,7 @@ private static void GenerateTestMetadata(CodeWriter writer, TestMethodMetadata t } else { - GenerateTestMetadataInstance(writer, testMethod, className, addToResultsList: false); + GenerateTestMetadataInstance(writer, testMethod, className, addToResultsList: false, useNamedMethods: true); writer.AppendLine("return new global::TUnit.Core.TestMetadata[] { metadata };"); } writer.Unindent(); @@ -392,13 +392,28 @@ private static void GenerateTestMetadata(CodeWriter writer, TestMethodMetadata t // Generate EnumerateTestDescriptors method for fast filtering GenerateEnumerateTestDescriptors(writer, testMethod); + if (!needsList) + { + // Emit named static helper methods to avoid generating a <>c display class. + // These are referenced by method group in the metadata above. + writer.AppendLine(); + EmitAttributeFactoryMethod(writer, testMethod); + writer.AppendLine(); + EmitInstanceFactoryMethod(writer, testMethod); + if (testMethod is { IsGenericType: false, IsGenericMethod: false }) + { + writer.AppendLine(); + EmitInvokeTestMethod(writer, testMethod, className); + } + } + writer.Unindent(); writer.AppendLine("}"); GenerateModuleInitializer(writer, testMethod, uniqueClassName); } - private static void GenerateTestMetadataInstance(CodeWriter writer, TestMethodMetadata testMethod, string className, bool addToResultsList = true) + private static void GenerateTestMetadataInstance(CodeWriter writer, TestMethodMetadata testMethod, string className, bool addToResultsList = true, bool useNamedMethods = false) { var methodName = testMethod.MethodSymbol.Name; @@ -419,7 +434,7 @@ private static void GenerateTestMetadataInstance(CodeWriter writer, TestMethodMe writer.AppendLine($"TestClassType = {GenerateTypeReference(testMethod.TypeSymbol, testMethod.IsGenericType)},"); writer.AppendLine($"TestMethodName = \"{methodName}\","); - GenerateMetadata(writer, testMethod); + GenerateMetadata(writer, testMethod, useNamedMethods); if (testMethod.IsGenericType) { @@ -433,7 +448,7 @@ private static void GenerateTestMetadataInstance(CodeWriter writer, TestMethodMe } // Generate typed invokers and factory - GenerateTypedInvokers(writer, testMethod, className); + GenerateTypedInvokers(writer, testMethod, className, useNamedMethods); writer.Unindent(); writer.AppendLine("};"); @@ -454,26 +469,33 @@ private static void GenerateTestMetadataInstance(CodeWriter writer, TestMethodMe } } - private static void GenerateMetadata(CodeWriter writer, TestMethodMetadata testMethod) + private static void GenerateMetadata(CodeWriter writer, TestMethodMetadata testMethod, bool useNamedMethods = false) { var compilation = testMethod.Context!.Value.SemanticModel.Compilation; var methodSymbol = testMethod.MethodSymbol; GenerateDependencies(writer, methodSymbol); - writer.AppendLine("AttributeFactory = static () =>"); - writer.AppendLine("["); - writer.Indent(); + if (useNamedMethods) + { + writer.AppendLine("AttributeFactory = __CreateAttributes,"); + } + else + { + writer.AppendLine("AttributeFactory = static () =>"); + writer.AppendLine("["); + writer.Indent(); - var attributes = methodSymbol.GetAttributes() - .Where(a => !DataSourceAttributeHelper.IsDataSourceAttribute(a.AttributeClass)) - .Concat(testMethod.TypeSymbol.GetAttributesIncludingBaseTypes()) - .Concat(testMethod.TypeSymbol.ContainingAssembly.GetAttributes()); + var attributes = methodSymbol.GetAttributes() + .Where(a => !DataSourceAttributeHelper.IsDataSourceAttribute(a.AttributeClass)) + .Concat(testMethod.TypeSymbol.GetAttributesIncludingBaseTypes()) + .Concat(testMethod.TypeSymbol.ContainingAssembly.GetAttributes()); - testMethod.CompilationContext.AttributeWriter.WriteAttributes(writer, attributes); + testMethod.CompilationContext.AttributeWriter.WriteAttributes(writer, attributes); - writer.Unindent(); - writer.AppendLine("],"); + writer.Unindent(); + writer.AppendLine("],"); + } // Extract and emit RepeatCount if present var repeatCount = ExtractRepeatCount(methodSymbol, testMethod.TypeSymbol); @@ -1776,7 +1798,7 @@ private static void GeneratePropertyValueExtraction(CodeWriter writer, ITypeSymb } } - private static void GenerateTypedInvokers(CodeWriter writer, TestMethodMetadata testMethod, string className) + private static void GenerateTypedInvokers(CodeWriter writer, TestMethodMetadata testMethod, string className, bool useNamedMethods = false) { var methodName = testMethod.MethodSymbol.Name; var parameters = testMethod.MethodSymbol.Parameters; @@ -1790,14 +1812,28 @@ private static void GenerateTypedInvokers(CodeWriter writer, TestMethodMetadata ? parameters.Take(parameters.Length - 1).ToArray() : parameters.ToArray(); - // Use centralized instance factory generator for all types (generic and non-generic) - InstanceFactoryGenerator.GenerateInstanceFactory(writer, testMethod.TypeSymbol, testMethod); + if (useNamedMethods) + { + writer.AppendLine("InstanceFactory = __CreateInstance,"); + } + else + { + // Use centralized instance factory generator for all types (generic and non-generic) + InstanceFactoryGenerator.GenerateInstanceFactory(writer, testMethod.TypeSymbol, testMethod); + } // Generate InvokeTypedTest for non-generic tests var returnPattern = GetReturnPattern(testMethod.MethodSymbol); if (testMethod is { IsGenericType: false, IsGenericMethod: false }) { - GenerateConcreteTestInvoker(writer, methodName, returnPattern, hasCancellationToken, parametersFromArgs); + if (useNamedMethods) + { + writer.AppendLine("InvokeTypedTest = __InvokeTest,"); + } + else + { + GenerateConcreteTestInvoker(writer, methodName, returnPattern, hasCancellationToken, parametersFromArgs); + } } } @@ -1807,8 +1843,14 @@ private static void GenerateConcreteTestInvoker(CodeWriter writer, string method writer.AppendLine("InvokeTypedTest = static (instance, args, cancellationToken) =>"); writer.AppendLine("{"); writer.Indent(); + GenerateConcreteTestInvokerBody(writer, methodName, returnPattern, hasCancellationToken, parametersFromArgs); + writer.Unindent(); + writer.AppendLine("},"); + } - // Wrap entire lambda body in try-catch to handle synchronous exceptions + private static void GenerateConcreteTestInvokerBody(CodeWriter writer, string methodName, TestReturnPattern returnPattern, bool hasCancellationToken, IParameterSymbol[] parametersFromArgs) + { + // Wrap entire body in try-catch to handle synchronous exceptions writer.AppendLine("try"); writer.AppendLine("{"); writer.Indent(); @@ -1934,9 +1976,66 @@ private static void GenerateConcreteTestInvoker(CodeWriter writer, string method writer.AppendLine("return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex));"); writer.Unindent(); writer.AppendLine("}"); + } + + /// + /// Emits the AttributeFactory as a named static method to avoid generating a display class. + /// + private static void EmitAttributeFactoryMethod(CodeWriter writer, TestMethodMetadata testMethod) + { + writer.AppendLine("private static global::System.Attribute[] __CreateAttributes()"); + writer.AppendLine("{"); + writer.Indent(); + + writer.AppendLine("return"); + writer.AppendLine("["); + writer.Indent(); + + var attributes = testMethod.MethodSymbol.GetAttributes() + .Where(a => !DataSourceAttributeHelper.IsDataSourceAttribute(a.AttributeClass)) + .Concat(testMethod.TypeSymbol.GetAttributesIncludingBaseTypes()) + .Concat(testMethod.TypeSymbol.ContainingAssembly.GetAttributes()); + + testMethod.CompilationContext.AttributeWriter.WriteAttributes(writer, attributes); writer.Unindent(); - writer.AppendLine("},"); + writer.AppendLine("];"); + + writer.Unindent(); + writer.AppendLine("}"); + } + + /// + /// Emits the InstanceFactory as a named static method to avoid generating a display class. + /// + private static void EmitInstanceFactoryMethod(CodeWriter writer, TestMethodMetadata testMethod) + { + InstanceFactoryGenerator.GenerateInstanceFactoryAsMethod(writer, testMethod.TypeSymbol); + } + + /// + /// Emits the InvokeTypedTest as a named static method to avoid generating a display class. + /// + private static void EmitInvokeTestMethod(CodeWriter writer, TestMethodMetadata testMethod, string className) + { + var methodName = testMethod.MethodSymbol.Name; + var parameters = testMethod.MethodSymbol.Parameters; + + var hasCancellationToken = parameters.Length > 0 && + parameters.Last().Type.GloballyQualified() == "global::System.Threading.CancellationToken"; + + var parametersFromArgs = hasCancellationToken + ? parameters.Take(parameters.Length - 1).ToArray() + : parameters.ToArray(); + + var returnPattern = GetReturnPattern(testMethod.MethodSymbol); + + writer.AppendLine($"private static global::System.Threading.Tasks.ValueTask __InvokeTest({className} instance, object?[] args, global::System.Threading.CancellationToken cancellationToken)"); + writer.AppendLine("{"); + writer.Indent(); + GenerateConcreteTestInvokerBody(writer, methodName, returnPattern, hasCancellationToken, parametersFromArgs); + writer.Unindent(); + writer.AppendLine("}"); } private static void GenerateEnumerateTestDescriptors(CodeWriter writer, TestMethodMetadata testMethod) diff --git a/TUnit.Core.SourceGenerator/Utilities/MetadataGenerationHelper.cs b/TUnit.Core.SourceGenerator/Utilities/MetadataGenerationHelper.cs index 2da6f06b2b..ae2f71ad28 100644 --- a/TUnit.Core.SourceGenerator/Utilities/MetadataGenerationHelper.cs +++ b/TUnit.Core.SourceGenerator/Utilities/MetadataGenerationHelper.cs @@ -78,20 +78,13 @@ public static string GenerateMethodMetadata(IMethodSymbol methodSymbol, string c private static void WriteClassMetadataGetOrAdd(ICodeWriter writer, INamedTypeSymbol typeSymbol, string? parentExpression = null) { var qualifiedName = $"{typeSymbol.ContainingAssembly.Name}:{typeSymbol.GloballyQualified()}"; - writer.AppendLine($"global::TUnit.Core.ClassMetadata.GetOrAdd(\"{qualifiedName}\", static () => "); + writer.AppendLine($"global::TUnit.Core.ClassMetadata.GetOrAdd(\"{qualifiedName}\", new global::TUnit.Core.ClassMetadata"); writer.AppendLine("{"); // Manually increment indent level without calling EnsureNewLine var currentIndent = writer.IndentLevel; writer.SetIndentLevel(currentIndent + 1); - // Create the ClassMetadata instance - writer.AppendLine("var classMetadata = new global::TUnit.Core.ClassMetadata"); - writer.AppendLine("{"); - - // Increment for the object initializer content - writer.SetIndentLevel(currentIndent + 2); - writer.AppendLine($"Type = typeof({typeSymbol.GloballyQualified()}),"); writer.AppendLine($"TypeInfo = {CodeGenerationHelpers.GenerateTypeInfo(typeSymbol)},"); writer.AppendLine($"Name = \"{typeSymbol.Name}\","); @@ -116,31 +109,10 @@ private static void WriteClassMetadataGetOrAdd(ICodeWriter writer, INamedTypeSym } writer.Append("Properties = "); - WritePropertyMetadataArray(writer, typeSymbol, out var propertyCount); + WritePropertyMetadataArray(writer, typeSymbol, out _); writer.AppendLine(","); writer.Append($"Parent = {parentExpression ?? "null"}"); - // Back to lambda body level - writer.SetIndentLevel(currentIndent + 1); - writer.AppendLine(); - writer.AppendLine("};"); - - if (propertyCount > 0) - { - // Set ClassMetadata reference on each property - writer.AppendLine("foreach (var prop in classMetadata.Properties)"); - writer.AppendLine("{"); - - writer.SetIndentLevel(currentIndent + 2); - writer.AppendLine("prop.ClassMetadata = classMetadata;"); - writer.Append("prop.ContainingTypeMetadata = classMetadata;"); - - writer.SetIndentLevel(currentIndent + 1); - writer.AppendLine(); - writer.AppendLine("}"); - } - writer.Append("return classMetadata;"); - // Back to original level writer.SetIndentLevel(currentIndent); writer.AppendLine(); @@ -172,12 +144,7 @@ public static string GenerateClassMetadataGetOrAdd(INamedTypeSymbol typeSymbol, { var qualifiedName = $"{typeSymbol.ContainingAssembly.Name}:{typeSymbol.GloballyQualified()}"; var writer = new CodeWriter("", includeHeader: false).SetIndentLevel(currentIndentLevel); - writer.AppendLine($"global::TUnit.Core.ClassMetadata.GetOrAdd(\"{qualifiedName}\", static () => "); - writer.AppendLine("{"); - writer.Indent(); - - // Create the ClassMetadata instance - writer.AppendLine("var classMetadata = new global::TUnit.Core.ClassMetadata"); + writer.AppendLine($"global::TUnit.Core.ClassMetadata.GetOrAdd(\"{qualifiedName}\", new global::TUnit.Core.ClassMetadata"); writer.AppendLine("{"); writer.Indent(); @@ -200,28 +167,9 @@ public static string GenerateClassMetadataGetOrAdd(INamedTypeSymbol typeSymbol, { writer.AppendLine("Parameters = global::System.Array.Empty(),"); } - writer.AppendLine($"Properties = {GeneratePropertyMetadataArray(typeSymbol, writer.IndentLevel, out var propertyCount)},"); + writer.AppendLine($"Properties = {GeneratePropertyMetadataArray(typeSymbol, writer.IndentLevel, out _)},"); writer.AppendLine($"Parent = {parentExpression ?? "null"}"); - writer.Unindent(); - writer.AppendLine("};"); - writer.AppendLine(); - - if(propertyCount > 0) - { - // Set ClassMetadata reference on each property - writer.AppendLine("foreach (var prop in classMetadata.Properties)"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendLine("prop.ClassMetadata = classMetadata;"); - writer.AppendLine("prop.ContainingTypeMetadata = classMetadata;"); - writer.Unindent(); - writer.AppendLine("}"); - writer.AppendLine(); - } - - writer.AppendLine("return classMetadata;"); - writer.Unindent(); writer.Append("})"); @@ -233,7 +181,7 @@ public static string GenerateClassMetadataGetOrAdd(INamedTypeSymbol typeSymbol, /// public static string GenerateAssemblyMetadataGetOrAdd(IAssemblySymbol assembly) { - return $"global::TUnit.Core.AssemblyMetadata.GetOrAdd(\"{assembly.Name}\", static () => new global::TUnit.Core.AssemblyMetadata {{ Name = \"{assembly.Name}\" }})"; + return $"global::TUnit.Core.AssemblyMetadata.GetOrAdd(\"{assembly.Name}\", \"{assembly.Name}\")"; } /// diff --git a/TUnit.Core/Models/TestModels/AssemblyMetadata.cs b/TUnit.Core/Models/TestModels/AssemblyMetadata.cs index d9fa0c4221..cee9095ae3 100644 --- a/TUnit.Core/Models/TestModels/AssemblyMetadata.cs +++ b/TUnit.Core/Models/TestModels/AssemblyMetadata.cs @@ -12,6 +12,11 @@ public static AssemblyMetadata GetOrAdd(string name, Func fact return Cache.GetOrAdd(name, static (_, factory) => factory(), factory); } + public static AssemblyMetadata GetOrAdd(string key, string name) + { + return Cache.GetOrAdd(key, static (_, n) => new AssemblyMetadata { Name = n }, name); + } + public virtual bool Equals(AssemblyMetadata? other) { if (other is null) diff --git a/TUnit.Core/Models/TestModels/ClassMetadata.cs b/TUnit.Core/Models/TestModels/ClassMetadata.cs index f17e67c37f..4e4dd30623 100644 --- a/TUnit.Core/Models/TestModels/ClassMetadata.cs +++ b/TUnit.Core/Models/TestModels/ClassMetadata.cs @@ -29,6 +29,28 @@ public static ClassMetadata GetOrAdd(string name, Func factory) return Cache.GetOrAdd(name, static (_, factory) => factory(), factory); } + public static ClassMetadata GetOrAdd(string name, ClassMetadata value) + { + // Set up property back-references + foreach (var prop in value.Properties) + { + prop.ClassMetadata = value; + prop.ContainingTypeMetadata = value; + } + + if (Cache.TryGetValue(name, out var existing)) + { + if (existing.Parameters.Length == 0 && value.Parameters.Length > 0) + { + Cache.TryUpdate(name, value, existing); + return value; + } + return existing; + } + + return Cache.GetOrAdd(name, static (_, v) => v, value); + } + public virtual bool Equals(ClassMetadata? other) { return Type == other?.Type; diff --git a/TUnit.PublicAPI/Tests.Core_Library_Has_No_API_Changes.DotNet10_0.verified.txt b/TUnit.PublicAPI/Tests.Core_Library_Has_No_API_Changes.DotNet10_0.verified.txt index 59d676c317..6c1ff99ce5 100644 --- a/TUnit.PublicAPI/Tests.Core_Library_Has_No_API_Changes.DotNet10_0.verified.txt +++ b/TUnit.PublicAPI/Tests.Core_Library_Has_No_API_Changes.DotNet10_0.verified.txt @@ -121,6 +121,7 @@ namespace public required string Name { get; init; } public virtual bool Equals(.AssemblyMetadata? other) { } public override int GetHashCode() { } + public static .AssemblyMetadata GetOrAdd(string key, string name) { } public static .AssemblyMetadata GetOrAdd(string name, <.AssemblyMetadata> factory) { } } public static class AsyncConvert @@ -378,6 +379,7 @@ namespace public virtual bool Equals(.ClassMetadata? other) { } public override int GetHashCode() { } public static .ClassMetadata GetOrAdd(string name, <.ClassMetadata> factory) { } + public static .ClassMetadata GetOrAdd(string name, .ClassMetadata value) { } } [(.Class | .Method)] public sealed class CombinedDataSourcesAttribute : .AsyncUntypedDataSourceGeneratorAttribute diff --git a/TUnit.PublicAPI/Tests.Core_Library_Has_No_API_Changes.DotNet8_0.verified.txt b/TUnit.PublicAPI/Tests.Core_Library_Has_No_API_Changes.DotNet8_0.verified.txt index 73325d809b..d09e1bd669 100644 --- a/TUnit.PublicAPI/Tests.Core_Library_Has_No_API_Changes.DotNet8_0.verified.txt +++ b/TUnit.PublicAPI/Tests.Core_Library_Has_No_API_Changes.DotNet8_0.verified.txt @@ -121,6 +121,7 @@ namespace public required string Name { get; init; } public virtual bool Equals(.AssemblyMetadata? other) { } public override int GetHashCode() { } + public static .AssemblyMetadata GetOrAdd(string key, string name) { } public static .AssemblyMetadata GetOrAdd(string name, <.AssemblyMetadata> factory) { } } public static class AsyncConvert @@ -378,6 +379,7 @@ namespace public virtual bool Equals(.ClassMetadata? other) { } public override int GetHashCode() { } public static .ClassMetadata GetOrAdd(string name, <.ClassMetadata> factory) { } + public static .ClassMetadata GetOrAdd(string name, .ClassMetadata value) { } } [(.Class | .Method)] public sealed class CombinedDataSourcesAttribute : .AsyncUntypedDataSourceGeneratorAttribute diff --git a/TUnit.PublicAPI/Tests.Core_Library_Has_No_API_Changes.DotNet9_0.verified.txt b/TUnit.PublicAPI/Tests.Core_Library_Has_No_API_Changes.DotNet9_0.verified.txt index c5e5894acf..6283b1a4ae 100644 --- a/TUnit.PublicAPI/Tests.Core_Library_Has_No_API_Changes.DotNet9_0.verified.txt +++ b/TUnit.PublicAPI/Tests.Core_Library_Has_No_API_Changes.DotNet9_0.verified.txt @@ -121,6 +121,7 @@ namespace public required string Name { get; init; } public virtual bool Equals(.AssemblyMetadata? other) { } public override int GetHashCode() { } + public static .AssemblyMetadata GetOrAdd(string key, string name) { } public static .AssemblyMetadata GetOrAdd(string name, <.AssemblyMetadata> factory) { } } public static class AsyncConvert @@ -378,6 +379,7 @@ namespace public virtual bool Equals(.ClassMetadata? other) { } public override int GetHashCode() { } public static .ClassMetadata GetOrAdd(string name, <.ClassMetadata> factory) { } + public static .ClassMetadata GetOrAdd(string name, .ClassMetadata value) { } } [(.Class | .Method)] public sealed class CombinedDataSourcesAttribute : .AsyncUntypedDataSourceGeneratorAttribute From 680304b0975eb84ee06a17914fbfd3ee9d1a6e39 Mon Sep 17 00:00:00 2001 From: Tom Longhurst <30480171+thomhurst@users.noreply.github.com> Date: Sun, 1 Mar 2026 22:07:17 +0000 Subject: [PATCH 2/2] refactor: address code review feedback on display class elimination - Extract shared GetTestAttributes() helper to deduplicate attribute collection logic between GenerateMetadata and EmitAttributeFactoryMethod - Extract shared ParseInvokerParameters() to deduplicate cancellation token/parameter parsing between GenerateTypedInvokers and EmitInvokeTestMethod - Add doc comment to ClassMetadata.GetOrAdd(string, ClassMetadata) explaining the pre-allocation trade-off (fewer JITs vs wasted allocations on cache hits) --- .../Generators/TestMetadataGenerator.cs | 58 ++++++++----------- TUnit.Core/Models/TestModels/ClassMetadata.cs | 6 ++ 2 files changed, 31 insertions(+), 33 deletions(-) diff --git a/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs b/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs index e0632f10ed..828cab2c23 100644 --- a/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs +++ b/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs @@ -486,12 +486,7 @@ private static void GenerateMetadata(CodeWriter writer, TestMethodMetadata testM writer.AppendLine("["); writer.Indent(); - var attributes = methodSymbol.GetAttributes() - .Where(a => !DataSourceAttributeHelper.IsDataSourceAttribute(a.AttributeClass)) - .Concat(testMethod.TypeSymbol.GetAttributesIncludingBaseTypes()) - .Concat(testMethod.TypeSymbol.ContainingAssembly.GetAttributes()); - - testMethod.CompilationContext.AttributeWriter.WriteAttributes(writer, attributes); + testMethod.CompilationContext.AttributeWriter.WriteAttributes(writer, GetTestAttributes(testMethod)); writer.Unindent(); writer.AppendLine("],"); @@ -1800,18 +1795,6 @@ private static void GeneratePropertyValueExtraction(CodeWriter writer, ITypeSymb private static void GenerateTypedInvokers(CodeWriter writer, TestMethodMetadata testMethod, string className, bool useNamedMethods = false) { - var methodName = testMethod.MethodSymbol.Name; - var parameters = testMethod.MethodSymbol.Parameters; - - // Check if last parameter is CancellationToken (regardless of whether it has a default value) - var hasCancellationToken = parameters.Length > 0 && - parameters.Last().Type.GloballyQualified() == "global::System.Threading.CancellationToken"; - - // Parameters that come from args (excluding CancellationToken) - var parametersFromArgs = hasCancellationToken - ? parameters.Take(parameters.Length - 1).ToArray() - : parameters.ToArray(); - if (useNamedMethods) { writer.AppendLine("InstanceFactory = __CreateInstance,"); @@ -1823,7 +1806,6 @@ private static void GenerateTypedInvokers(CodeWriter writer, TestMethodMetadata } // Generate InvokeTypedTest for non-generic tests - var returnPattern = GetReturnPattern(testMethod.MethodSymbol); if (testMethod is { IsGenericType: false, IsGenericMethod: false }) { if (useNamedMethods) @@ -1832,7 +1814,9 @@ private static void GenerateTypedInvokers(CodeWriter writer, TestMethodMetadata } else { - GenerateConcreteTestInvoker(writer, methodName, returnPattern, hasCancellationToken, parametersFromArgs); + var (hasCancellationToken, parametersFromArgs) = ParseInvokerParameters(testMethod.MethodSymbol); + var returnPattern = GetReturnPattern(testMethod.MethodSymbol); + GenerateConcreteTestInvoker(writer, testMethod.MethodSymbol.Name, returnPattern, hasCancellationToken, parametersFromArgs); } } } @@ -1978,6 +1962,14 @@ private static void GenerateConcreteTestInvokerBody(CodeWriter writer, string me writer.AppendLine("}"); } + private static IEnumerable GetTestAttributes(TestMethodMetadata testMethod) + { + return testMethod.MethodSymbol.GetAttributes() + .Where(a => !DataSourceAttributeHelper.IsDataSourceAttribute(a.AttributeClass)) + .Concat(testMethod.TypeSymbol.GetAttributesIncludingBaseTypes()) + .Concat(testMethod.TypeSymbol.ContainingAssembly.GetAttributes()); + } + /// /// Emits the AttributeFactory as a named static method to avoid generating a display class. /// @@ -1991,12 +1983,7 @@ private static void EmitAttributeFactoryMethod(CodeWriter writer, TestMethodMeta writer.AppendLine("["); writer.Indent(); - var attributes = testMethod.MethodSymbol.GetAttributes() - .Where(a => !DataSourceAttributeHelper.IsDataSourceAttribute(a.AttributeClass)) - .Concat(testMethod.TypeSymbol.GetAttributesIncludingBaseTypes()) - .Concat(testMethod.TypeSymbol.ContainingAssembly.GetAttributes()); - - testMethod.CompilationContext.AttributeWriter.WriteAttributes(writer, attributes); + testMethod.CompilationContext.AttributeWriter.WriteAttributes(writer, GetTestAttributes(testMethod)); writer.Unindent(); writer.AppendLine("];"); @@ -2013,13 +2000,9 @@ private static void EmitInstanceFactoryMethod(CodeWriter writer, TestMethodMetad InstanceFactoryGenerator.GenerateInstanceFactoryAsMethod(writer, testMethod.TypeSymbol); } - /// - /// Emits the InvokeTypedTest as a named static method to avoid generating a display class. - /// - private static void EmitInvokeTestMethod(CodeWriter writer, TestMethodMetadata testMethod, string className) + private static (bool HasCancellationToken, IParameterSymbol[] ParametersFromArgs) ParseInvokerParameters(IMethodSymbol methodSymbol) { - var methodName = testMethod.MethodSymbol.Name; - var parameters = testMethod.MethodSymbol.Parameters; + var parameters = methodSymbol.Parameters; var hasCancellationToken = parameters.Length > 0 && parameters.Last().Type.GloballyQualified() == "global::System.Threading.CancellationToken"; @@ -2028,12 +2011,21 @@ private static void EmitInvokeTestMethod(CodeWriter writer, TestMethodMetadata t ? parameters.Take(parameters.Length - 1).ToArray() : parameters.ToArray(); + return (hasCancellationToken, parametersFromArgs); + } + + /// + /// Emits the InvokeTypedTest as a named static method to avoid generating a display class. + /// + private static void EmitInvokeTestMethod(CodeWriter writer, TestMethodMetadata testMethod, string className) + { + var (hasCancellationToken, parametersFromArgs) = ParseInvokerParameters(testMethod.MethodSymbol); var returnPattern = GetReturnPattern(testMethod.MethodSymbol); writer.AppendLine($"private static global::System.Threading.Tasks.ValueTask __InvokeTest({className} instance, object?[] args, global::System.Threading.CancellationToken cancellationToken)"); writer.AppendLine("{"); writer.Indent(); - GenerateConcreteTestInvokerBody(writer, methodName, returnPattern, hasCancellationToken, parametersFromArgs); + GenerateConcreteTestInvokerBody(writer, testMethod.MethodSymbol.Name, returnPattern, hasCancellationToken, parametersFromArgs); writer.Unindent(); writer.AppendLine("}"); } diff --git a/TUnit.Core/Models/TestModels/ClassMetadata.cs b/TUnit.Core/Models/TestModels/ClassMetadata.cs index 4e4dd30623..9320b49bc3 100644 --- a/TUnit.Core/Models/TestModels/ClassMetadata.cs +++ b/TUnit.Core/Models/TestModels/ClassMetadata.cs @@ -29,6 +29,12 @@ public static ClassMetadata GetOrAdd(string name, Func factory) return Cache.GetOrAdd(name, static (_, factory) => factory(), factory); } + /// + /// Gets or adds a ClassMetadata from the cache using a pre-constructed value. + /// This overload trades potential wasted allocations on cache hits for eliminating + /// a factory lambda in generated code, which removes the compiler-generated <>c + /// display class and its JIT overhead (~3 methods per test source). + /// public static ClassMetadata GetOrAdd(string name, ClassMetadata value) { // Set up property back-references