diff --git a/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete1.verified.txt b/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete1.verified.txt index a233745939..40b8e51e1c 100644 --- a/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete1.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete1.verified.txt @@ -1,61 +1,52 @@ -// +// #pragma warning disable #nullable enable namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClassName_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal static class TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClassName_TestSource { - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AbstractTests.ConcreteClass1", new global::TUnit.Core.ClassMetadata { - var metadata = new global::TUnit.Core.TestMetadata + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("AssertClassName", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static global::TUnit.TestProject.AbstractTests.ConcreteClass1 __CreateInstance_0(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.AbstractTests.ConcreteClass1(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.AbstractTests.ConcreteClass1 instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try { - TestName = "AssertClassName", - TestClassType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1), - TestMethodName = "AssertClassName", - Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - InheritanceDepth = 1, - FilePath = @"", - LineNumber = 3, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - Type = typeof(global::TUnit.TestProject.AbstractTests.AbstractBaseClass), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AbstractTests.AbstractBaseClass)), - Name = "AssertClassName", - GenericTypeCount = 0, - 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", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = __CreateInstance, - InvokeTypedTest = __InvokeTest, + 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)); + } + } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.InheritsTestsAttribute() }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.AbstractTests.ConcreteClass1.AssertClassName", - ClassName = "ConcreteClass1", MethodName = "AssertClassName", FullyQualifiedName = "TUnit.TestProject.AbstractTests.ConcreteClass1.AssertClassName", FilePath = @"", @@ -65,34 +56,16 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClass HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - 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)); - } - } + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClassName_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1), new TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClassName_TestSource()); + static readonly int _r_TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClassName_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClassName_TestSource.Entries_0); } diff --git a/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete2.verified.txt b/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete2.verified.txt index 9d37c10762..b258156575 100644 --- a/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete2.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete2.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,34 +7,64 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_AbstractTests_ConcreteClass2__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AbstractTests.ConcreteClass2", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("SecondTest", __classType, typeof(void), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.AbstractTests.ConcreteClass2 instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AbstractTests.ConcreteClass2", new global::TUnit.Core.ClassMetadata + switch (methodIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2); - var metadata_SecondTest = global::TUnit.Core.TestMetadataFactory.Create( - "SecondTest", "SecondTest", 11, - __InvokeTest_SecondTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SecondTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_SecondTest }; + case 0: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Attribute[] __Attributes(int groupIndex) { - yield return new global::TUnit.Core.TestDescriptor + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.InheritsTestsAttribute(), + new global::TUnit.Core.InheritsTestsAttribute() + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } + } + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.AbstractTests.ConcreteClass2.SecondTest", - ClassName = "ConcreteClass2", MethodName = "SecondTest", FullyQualifiedName = "TUnit.TestProject.AbstractTests.ConcreteClass2.SecondTest", FilePath = @"", @@ -44,60 +74,18 @@ internal static class TUnit_TestProject_AbstractTests_ConcreteClass2__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_SecondTest - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.InheritsTestsAttribute(), - new global::TUnit.Core.InheritsTestsAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_SecondTest(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_SecondTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AbstractTests.ConcreteClass2", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "SecondTest", "SecondTest", 11, - __InvokeTest_SecondTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SecondTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.AbstractTests.ConcreteClass2 CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.AbstractTests.ConcreteClass2(); - } + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_AbstractTests_ConcreteClass2__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), TUnit_TestProject_AbstractTests_ConcreteClass2__TestSource.GetTests, TUnit_TestProject_AbstractTests_ConcreteClass2__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_AbstractTests_ConcreteClass2__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_AbstractTests_ConcreteClass2__TestSource.Entries); } @@ -110,57 +98,49 @@ internal static partial class TUnit_TestRegistration namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_AssertClassName_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal static class TUnit_TestProject_AbstractTests_ConcreteClass2_AssertClassName_TestSource { - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AbstractTests.ConcreteClass2", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("AssertClassName", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static global::TUnit.TestProject.AbstractTests.ConcreteClass2 __CreateInstance_0(global::System.Type[] typeArgs, object?[] args) { - var metadata = new global::TUnit.Core.TestMetadata + return new global::TUnit.TestProject.AbstractTests.ConcreteClass2(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.AbstractTests.ConcreteClass2 instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try { - TestName = "AssertClassName", - TestClassType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), - TestMethodName = "AssertClassName", - Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - InheritanceDepth = 2, - FilePath = @"", - LineNumber = 3, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - Type = typeof(global::TUnit.TestProject.AbstractTests.AbstractBaseClass), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AbstractTests.AbstractBaseClass)), - Name = "AssertClassName", - GenericTypeCount = 0, - 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", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = __CreateInstance, - InvokeTypedTest = __InvokeTest, + 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)); + } + } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.InheritsTestsAttribute(), + new global::TUnit.Core.InheritsTestsAttribute() }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.AbstractTests.ConcreteClass2.AssertClassName", - ClassName = "ConcreteClass2", MethodName = "AssertClassName", FullyQualifiedName = "TUnit.TestProject.AbstractTests.ConcreteClass2.AssertClassName", FilePath = @"", @@ -170,37 +150,18 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_AssertClass HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - 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)); - } - } + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_AbstractTests_ConcreteClass2_AssertClassName_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), new TUnit_TestProject_AbstractTests_ConcreteClass2_AssertClassName_TestSource()); + static readonly int _r_TUnit_TestProject_AbstractTests_ConcreteClass2_AssertClassName_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_AbstractTests_ConcreteClass2_AssertClassName_TestSource.Entries_0); } @@ -213,57 +174,48 @@ internal static partial class TUnit_TestRegistration namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClassName_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal static class TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClassName_TestSource { - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AbstractTests.ConcreteClass1", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("AssertClassName", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static global::TUnit.TestProject.AbstractTests.ConcreteClass1 __CreateInstance_0(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.AbstractTests.ConcreteClass1(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.AbstractTests.ConcreteClass1 instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) { - var metadata = new global::TUnit.Core.TestMetadata + try { - TestName = "AssertClassName", - TestClassType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1), - TestMethodName = "AssertClassName", - Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - InheritanceDepth = 1, - FilePath = @"", - LineNumber = 3, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - Type = typeof(global::TUnit.TestProject.AbstractTests.AbstractBaseClass), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AbstractTests.AbstractBaseClass)), - Name = "AssertClassName", - GenericTypeCount = 0, - 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", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = __CreateInstance, - InvokeTypedTest = __InvokeTest, + 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)); + } + } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.InheritsTestsAttribute() }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.AbstractTests.ConcreteClass1.AssertClassName", - ClassName = "ConcreteClass1", MethodName = "AssertClassName", FullyQualifiedName = "TUnit.TestProject.AbstractTests.ConcreteClass1.AssertClassName", FilePath = @"", @@ -273,34 +225,16 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClass HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - 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)); - } - } + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClassName_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1), new TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClassName_TestSource()); + static readonly int _r_TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClassName_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClassName_TestSource.Entries_0); } diff --git a/TUnit.Core.SourceGenerator.Tests/AfterAllTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/AfterAllTests.Test.verified.txt index fe4159b8ea..17ca7315df 100644 --- a/TUnit.Core.SourceGenerator.Tests/AfterAllTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AfterAllTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,40 +7,73 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_AfterTests_CleanupTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.CleanupTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.CleanupTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.AfterTests.CleanupTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Test1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("Test2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.AfterTests.CleanupTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.AfterTests.CleanupTests); - var metadata_Test1 = global::TUnit.Core.TestMetadataFactory.Create( - "Test1", "Test1", 98, - __InvokeTest_Test1, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - var metadata_Test2 = global::TUnit.Core.TestMetadataFactory.Create( - "Test2", "Test2", 104, - __InvokeTest_Test2, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_Test1, metadata_Test2 }; + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.AfterTests.CleanupTests.Test1", - ClassName = "CleanupTests", MethodName = "Test1", FullyQualifiedName = "TUnit.TestProject.AfterTests.CleanupTests.Test1", FilePath = @"", @@ -50,12 +83,15 @@ internal static class TUnit_TestProject_AfterTests_CleanupTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Test1 - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.AfterTests.CleanupTests.Test2", - ClassName = "CleanupTests", MethodName = "Test2", FullyQualifiedName = "TUnit.TestProject.AfterTests.CleanupTests.Test2", FilePath = @"", @@ -65,88 +101,16 @@ internal static class TUnit_TestProject_AfterTests_CleanupTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Test2 - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Test1(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Test2(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test1(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.CleanupTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.AfterTests.CleanupTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Test1", "Test1", 98, - __InvokeTest_Test1, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test2(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.CleanupTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.AfterTests.CleanupTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Test2", "Test2", 104, - __InvokeTest_Test2, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.AfterTests.CleanupTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.AfterTests.CleanupTests(); - } + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_AfterTests_CleanupTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.AfterTests.CleanupTests), TUnit_TestProject_AfterTests_CleanupTests__TestSource.GetTests, TUnit_TestProject_AfterTests_CleanupTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_AfterTests_CleanupTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_AfterTests_CleanupTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/AfterTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/AfterTests.Test.verified.txt index fe4159b8ea..17ca7315df 100644 --- a/TUnit.Core.SourceGenerator.Tests/AfterTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AfterTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,40 +7,73 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_AfterTests_CleanupTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.CleanupTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.CleanupTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.AfterTests.CleanupTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Test1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("Test2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.AfterTests.CleanupTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.AfterTests.CleanupTests); - var metadata_Test1 = global::TUnit.Core.TestMetadataFactory.Create( - "Test1", "Test1", 98, - __InvokeTest_Test1, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - var metadata_Test2 = global::TUnit.Core.TestMetadataFactory.Create( - "Test2", "Test2", 104, - __InvokeTest_Test2, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_Test1, metadata_Test2 }; + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.AfterTests.CleanupTests.Test1", - ClassName = "CleanupTests", MethodName = "Test1", FullyQualifiedName = "TUnit.TestProject.AfterTests.CleanupTests.Test1", FilePath = @"", @@ -50,12 +83,15 @@ internal static class TUnit_TestProject_AfterTests_CleanupTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Test1 - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.AfterTests.CleanupTests.Test2", - ClassName = "CleanupTests", MethodName = "Test2", FullyQualifiedName = "TUnit.TestProject.AfterTests.CleanupTests.Test2", FilePath = @"", @@ -65,88 +101,16 @@ internal static class TUnit_TestProject_AfterTests_CleanupTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Test2 - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Test1(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Test2(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test1(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.CleanupTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.AfterTests.CleanupTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Test1", "Test1", 98, - __InvokeTest_Test1, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test2(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AfterTests.CleanupTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.AfterTests.CleanupTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Test2", "Test2", 104, - __InvokeTest_Test2, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.AfterTests.CleanupTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.AfterTests.CleanupTests(); - } + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_AfterTests_CleanupTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.AfterTests.CleanupTests), TUnit_TestProject_AfterTests_CleanupTests__TestSource.GetTests, TUnit_TestProject_AfterTests_CleanupTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_AfterTests_CleanupTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_AfterTests_CleanupTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/ArgsAsArrayTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ArgsAsArrayTests.Test.verified.txt index 0076876248..8ce74c5c18 100644 --- a/TUnit.Core.SourceGenerator.Tests/ArgsAsArrayTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ArgsAsArrayTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,68 +7,212 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_ArgsAsArrayTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ArgsAsArrayTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ArgsAsArrayTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.ArgsAsArrayTests); - var metadata_Params__string__ = global::TUnit.Core.TestMetadataFactory.Create( - "Params", "Params", 5, - __InvokeTest_Params__string__, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Params", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string[]), "arguments", new global::TUnit.Core.ConcreteType(typeof(string[])), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("arg1", "arg2", "arg3"), - }, - testSessionId: testSessionId - ); - var metadata_ParamsEnumerable__IEnumerable_string_ = global::TUnit.Core.TestMetadataFactory.Create( - "ParamsEnumerable", "ParamsEnumerable", 15, - __InvokeTest_ParamsEnumerable__IEnumerable_string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ParamsEnumerable", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Collections.Generic.IEnumerable), "arguments", new global::TUnit.Core.ConcreteType(typeof(global::System.Collections.Generic.IEnumerable)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("arg1", "arg2", "arg3"), - }, - testSessionId: testSessionId - ); - var metadata_Following_Non_Params__int_IEnumerable_string_ = global::TUnit.Core.TestMetadataFactory.Create( - "Following_Non_Params", "Following_Non_Params", 25, - __InvokeTest_Following_Non_Params__int_IEnumerable_string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Following_Non_Params", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.ArgsAsArrayTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Params", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string[]), "arguments", new global::TUnit.Core.ConcreteType(typeof(string[])), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("ParamsEnumerable", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Collections.Generic.IEnumerable), "arguments", new global::TUnit.Core.ConcreteType(typeof(global::System.Collections.Generic.IEnumerable)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("Following_Non_Params", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Collections.Generic.IEnumerable), "arguments", new global::TUnit.Core.ConcreteType(typeof(global::System.Collections.Generic.IEnumerable)), false, reflectionInfoFactory: static () => 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]) +}); + 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 __Invoke(global::TUnit.TestProject.ArgsAsArrayTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Collections.Generic.IEnumerable), "arguments", new global::TUnit.Core.ConcreteType(typeof(global::System.Collections.Generic.IEnumerable)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - new global::TUnit.Core.ArgumentsAttribute(1, "arg1", "arg2", "arg3"), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_Params__string__, metadata_ParamsEnumerable__IEnumerable_string_, metadata_Following_Non_Params__int_IEnumerable_string_ }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.ArgsAsArrayTests.Params", - ClassName = "ArgsAsArrayTests", MethodName = "Params", FullyQualifiedName = "TUnit.TestProject.ArgsAsArrayTests.Params", FilePath = @"", @@ -78,12 +222,19 @@ internal static class TUnit_TestProject_ArgsAsArrayTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Params__string__ - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute("arg1", "arg2", "arg3"), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.ArgsAsArrayTests.ParamsEnumerable", - ClassName = "ArgsAsArrayTests", MethodName = "ParamsEnumerable", FullyQualifiedName = "TUnit.TestProject.ArgsAsArrayTests.ParamsEnumerable", FilePath = @"", @@ -93,12 +244,19 @@ internal static class TUnit_TestProject_ArgsAsArrayTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_ParamsEnumerable__IEnumerable_string_ - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute("arg1", "arg2", "arg3"), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.ArgsAsArrayTests.Following_Non_Params", - ClassName = "ArgsAsArrayTests", MethodName = "Following_Non_Params", FullyQualifiedName = "TUnit.TestProject.ArgsAsArrayTests.Following_Non_Params", FilePath = @"", @@ -108,260 +266,20 @@ internal static class TUnit_TestProject_ArgsAsArrayTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Following_Non_Params__int_IEnumerable_string_ - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Params__string__(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_ParamsEnumerable__IEnumerable_string_(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Following_Non_Params__int_IEnumerable_string_(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Params__string__(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ArgsAsArrayTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.ArgsAsArrayTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Params", "Params", 5, - __InvokeTest_Params__string__, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Params", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string[]), "arguments", new global::TUnit.Core.ConcreteType(typeof(string[])), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("arg1", "arg2", "arg3"), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_ParamsEnumerable__IEnumerable_string_(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ArgsAsArrayTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.ArgsAsArrayTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "ParamsEnumerable", "ParamsEnumerable", 15, - __InvokeTest_ParamsEnumerable__IEnumerable_string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ParamsEnumerable", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Collections.Generic.IEnumerable), "arguments", new global::TUnit.Core.ConcreteType(typeof(global::System.Collections.Generic.IEnumerable)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("arg1", "arg2", "arg3"), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Following_Non_Params__int_IEnumerable_string_(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ArgsAsArrayTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.ArgsAsArrayTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Following_Non_Params", "Following_Non_Params", 25, - __InvokeTest_Following_Non_Params__int_IEnumerable_string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Following_Non_Params", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Collections.Generic.IEnumerable), "arguments", new global::TUnit.Core.ConcreteType(typeof(global::System.Collections.Generic.IEnumerable)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1, "arg1", "arg2", "arg3"), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.ArgsAsArrayTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.ArgsAsArrayTests(); - } + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(1, "arg1", "arg2", "arg3"), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_ArgsAsArrayTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.ArgsAsArrayTests), TUnit_TestProject_ArgsAsArrayTests__TestSource.GetTests, TUnit_TestProject_ArgsAsArrayTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_ArgsAsArrayTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_ArgsAsArrayTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/ArgumentWithImplicitConverterTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ArgumentWithImplicitConverterTests.Test.verified.txt index 8591dcea4a..5a53b13b3c 100644 --- a/TUnit.Core.SourceGenerator.Tests/ArgumentWithImplicitConverterTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ArgumentWithImplicitConverterTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,58 +7,98 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_ArgumentWithImplicitConverterTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ArgumentWithImplicitConverterTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ArgumentWithImplicitConverterTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.ArgumentWithImplicitConverterTests); - var metadata_Explicit__ExplicitInteger = global::TUnit.Core.TestMetadataFactory.Create( - "Explicit", "Explicit", 8, - __InvokeTest_Explicit__ExplicitInteger, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Explicit", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.ExplicitInteger), "integer", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ExplicitInteger)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1), - new global::TUnit.Core.ArgumentsAttribute(2), - new global::TUnit.Core.ArgumentsAttribute(3), - }, - testSessionId: testSessionId - ); - var metadata_Implicit__ImplicitInteger = global::TUnit.Core.TestMetadataFactory.Create( - "Implicit", "Implicit", 17, - __InvokeTest_Implicit__ImplicitInteger, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Implicit", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.ArgumentWithImplicitConverterTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Explicit", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.ExplicitInteger), "integer", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ExplicitInteger)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("Implicit", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.ImplicitInteger), "integer", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ImplicitInteger)), false, reflectionInfoFactory: static () => 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]) +}); + 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 __Invoke(global::TUnit.TestProject.ArgumentWithImplicitConverterTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.ImplicitInteger), "integer", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ImplicitInteger)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - new global::TUnit.Core.ArgumentsAttribute(1), - new global::TUnit.Core.ArgumentsAttribute(2), - new global::TUnit.Core.ArgumentsAttribute(3), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_Explicit__ExplicitInteger, metadata_Implicit__ImplicitInteger }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.ArgumentWithImplicitConverterTests.Explicit", - ClassName = "ArgumentWithImplicitConverterTests", MethodName = "Explicit", FullyQualifiedName = "TUnit.TestProject.ArgumentWithImplicitConverterTests.Explicit", FilePath = @"", @@ -68,12 +108,21 @@ internal static class TUnit_TestProject_ArgumentWithImplicitConverterTests__Test HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Explicit__ExplicitInteger - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(1), + new global::TUnit.Core.ArgumentsAttribute(2), + new global::TUnit.Core.ArgumentsAttribute(3), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.ArgumentWithImplicitConverterTests.Implicit", - ClassName = "ArgumentWithImplicitConverterTests", MethodName = "Implicit", FullyQualifiedName = "TUnit.TestProject.ArgumentWithImplicitConverterTests.Implicit", FilePath = @"", @@ -83,125 +132,22 @@ internal static class TUnit_TestProject_ArgumentWithImplicitConverterTests__Test HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Implicit__ImplicitInteger - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Explicit__ExplicitInteger(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Implicit__ImplicitInteger(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Explicit__ExplicitInteger(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ArgumentWithImplicitConverterTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.ArgumentWithImplicitConverterTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Explicit", "Explicit", 8, - __InvokeTest_Explicit__ExplicitInteger, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Explicit", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.ExplicitInteger), "integer", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ExplicitInteger)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1), - new global::TUnit.Core.ArgumentsAttribute(2), - new global::TUnit.Core.ArgumentsAttribute(3), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Implicit__ImplicitInteger(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ArgumentWithImplicitConverterTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.ArgumentWithImplicitConverterTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Implicit", "Implicit", 17, - __InvokeTest_Implicit__ImplicitInteger, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Implicit", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.ImplicitInteger), "integer", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ImplicitInteger)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1), - new global::TUnit.Core.ArgumentsAttribute(2), - new global::TUnit.Core.ArgumentsAttribute(3), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.ArgumentWithImplicitConverterTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.ArgumentWithImplicitConverterTests(); - } + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(1), + new global::TUnit.Core.ArgumentsAttribute(2), + new global::TUnit.Core.ArgumentsAttribute(3), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_ArgumentWithImplicitConverterTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.ArgumentWithImplicitConverterTests), TUnit_TestProject_ArgumentWithImplicitConverterTests__TestSource.GetTests, TUnit_TestProject_ArgumentWithImplicitConverterTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_ArgumentWithImplicitConverterTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_ArgumentWithImplicitConverterTests__TestSource.Entries); } 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 541c2796f2..0aa3823183 100644 --- a/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet10_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet10_0.verified.txt @@ -7,46 +7,86 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_BasicTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.BasicTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.BasicTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata_SynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "SynchronousTest", "SynchronousTest", 5, - __InvokeTest_SynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - var metadata_AsynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "AsynchronousTest", "AsynchronousTest", 11, - __InvokeTest_AsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - var metadata_ValueTaskAsynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "ValueTaskAsynchronousTest", "ValueTaskAsynchronousTest", 17, - __InvokeTest_ValueTaskAsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_SynchronousTest, metadata_AsynchronousTest, metadata_ValueTaskAsynchronousTest }; + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: + { + try + { + return instance.ValueTaskAsynchronousTest(); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Attribute[] __Attributes(int groupIndex) { - yield return new global::TUnit.Core.TestDescriptor + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } + } + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.SynchronousTest", - ClassName = "BasicTests", MethodName = "SynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.SynchronousTest", FilePath = @"", @@ -56,12 +96,15 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_SynchronousTest - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", - ClassName = "BasicTests", MethodName = "AsynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", FilePath = @"", @@ -71,12 +114,15 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_AsynchronousTest - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - ClassName = "BasicTests", MethodName = "ValueTaskAsynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", FilePath = @"", @@ -86,122 +132,16 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_ValueTaskAsynchronousTest - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_SynchronousTest(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_AsynchronousTest(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_ValueTaskAsynchronousTest(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_SynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "SynchronousTest", "SynchronousTest", 5, - __InvokeTest_SynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "AsynchronousTest", "AsynchronousTest", 11, - __InvokeTest_AsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_ValueTaskAsynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "ValueTaskAsynchronousTest", "ValueTaskAsynchronousTest", 17, - __InvokeTest_ValueTaskAsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.BasicTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_BasicTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.BasicTests), TUnit_TestProject_BasicTests__TestSource.GetTests, TUnit_TestProject_BasicTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_BasicTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_BasicTests__TestSource.Entries); } 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 541c2796f2..0aa3823183 100644 --- a/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet8_0.verified.txt @@ -7,46 +7,86 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_BasicTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.BasicTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.BasicTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata_SynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "SynchronousTest", "SynchronousTest", 5, - __InvokeTest_SynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - var metadata_AsynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "AsynchronousTest", "AsynchronousTest", 11, - __InvokeTest_AsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - var metadata_ValueTaskAsynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "ValueTaskAsynchronousTest", "ValueTaskAsynchronousTest", 17, - __InvokeTest_ValueTaskAsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_SynchronousTest, metadata_AsynchronousTest, metadata_ValueTaskAsynchronousTest }; + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: + { + try + { + return instance.ValueTaskAsynchronousTest(); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Attribute[] __Attributes(int groupIndex) { - yield return new global::TUnit.Core.TestDescriptor + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } + } + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.SynchronousTest", - ClassName = "BasicTests", MethodName = "SynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.SynchronousTest", FilePath = @"", @@ -56,12 +96,15 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_SynchronousTest - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", - ClassName = "BasicTests", MethodName = "AsynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", FilePath = @"", @@ -71,12 +114,15 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_AsynchronousTest - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - ClassName = "BasicTests", MethodName = "ValueTaskAsynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", FilePath = @"", @@ -86,122 +132,16 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_ValueTaskAsynchronousTest - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_SynchronousTest(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_AsynchronousTest(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_ValueTaskAsynchronousTest(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_SynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "SynchronousTest", "SynchronousTest", 5, - __InvokeTest_SynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "AsynchronousTest", "AsynchronousTest", 11, - __InvokeTest_AsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_ValueTaskAsynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "ValueTaskAsynchronousTest", "ValueTaskAsynchronousTest", 17, - __InvokeTest_ValueTaskAsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.BasicTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_BasicTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.BasicTests), TUnit_TestProject_BasicTests__TestSource.GetTests, TUnit_TestProject_BasicTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_BasicTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_BasicTests__TestSource.Entries); } 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 541c2796f2..0aa3823183 100644 --- a/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet9_0.verified.txt @@ -7,46 +7,86 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_BasicTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.BasicTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.BasicTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata_SynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "SynchronousTest", "SynchronousTest", 5, - __InvokeTest_SynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - var metadata_AsynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "AsynchronousTest", "AsynchronousTest", 11, - __InvokeTest_AsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - var metadata_ValueTaskAsynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "ValueTaskAsynchronousTest", "ValueTaskAsynchronousTest", 17, - __InvokeTest_ValueTaskAsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_SynchronousTest, metadata_AsynchronousTest, metadata_ValueTaskAsynchronousTest }; + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: + { + try + { + return instance.ValueTaskAsynchronousTest(); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Attribute[] __Attributes(int groupIndex) { - yield return new global::TUnit.Core.TestDescriptor + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } + } + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.SynchronousTest", - ClassName = "BasicTests", MethodName = "SynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.SynchronousTest", FilePath = @"", @@ -56,12 +96,15 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_SynchronousTest - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", - ClassName = "BasicTests", MethodName = "AsynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", FilePath = @"", @@ -71,12 +114,15 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_AsynchronousTest - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - ClassName = "BasicTests", MethodName = "ValueTaskAsynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", FilePath = @"", @@ -86,122 +132,16 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_ValueTaskAsynchronousTest - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_SynchronousTest(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_AsynchronousTest(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_ValueTaskAsynchronousTest(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_SynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "SynchronousTest", "SynchronousTest", 5, - __InvokeTest_SynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "AsynchronousTest", "AsynchronousTest", 11, - __InvokeTest_AsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_ValueTaskAsynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "ValueTaskAsynchronousTest", "ValueTaskAsynchronousTest", 17, - __InvokeTest_ValueTaskAsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.BasicTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_BasicTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.BasicTests), TUnit_TestProject_BasicTests__TestSource.GetTests, TUnit_TestProject_BasicTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_BasicTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_BasicTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.Net4_7.verified.txt b/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.Net4_7.verified.txt index a791373b8c..d67d8a3266 100644 --- a/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.Net4_7.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.Net4_7.verified.txt @@ -7,46 +7,86 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_BasicTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.BasicTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.BasicTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata_SynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "SynchronousTest", "SynchronousTest", 5, - __InvokeTest_SynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - var metadata_AsynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "AsynchronousTest", "AsynchronousTest", 11, - __InvokeTest_AsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - var metadata_ValueTaskAsynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "ValueTaskAsynchronousTest", "ValueTaskAsynchronousTest", 17, - __InvokeTest_ValueTaskAsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_SynchronousTest, metadata_AsynchronousTest, metadata_ValueTaskAsynchronousTest }; + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: + { + try + { + return instance.ValueTaskAsynchronousTest(); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Attribute[] __Attributes(int groupIndex) { - yield return new global::TUnit.Core.TestDescriptor + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } + } + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.SynchronousTest", - ClassName = "BasicTests", MethodName = "SynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.SynchronousTest", FilePath = @"", @@ -56,12 +96,15 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_SynchronousTest - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", - ClassName = "BasicTests", MethodName = "AsynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", FilePath = @"", @@ -71,12 +114,15 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_AsynchronousTest - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - ClassName = "BasicTests", MethodName = "ValueTaskAsynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", FilePath = @"", @@ -86,122 +132,16 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_ValueTaskAsynchronousTest - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_SynchronousTest(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_AsynchronousTest(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_ValueTaskAsynchronousTest(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_SynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "SynchronousTest", "SynchronousTest", 5, - __InvokeTest_SynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "AsynchronousTest", "AsynchronousTest", 11, - __InvokeTest_AsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_ValueTaskAsynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "ValueTaskAsynchronousTest", "ValueTaskAsynchronousTest", 17, - __InvokeTest_ValueTaskAsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.BasicTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_BasicTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.BasicTests), TUnit_TestProject_BasicTests__TestSource.GetTests, TUnit_TestProject_BasicTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_BasicTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_BasicTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/AsyncMethodDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/AsyncMethodDataSourceDrivenTests.Test.verified.txt index 4a45c27feb..cd024d72e4 100644 --- a/TUnit.Core.SourceGenerator.Tests/AsyncMethodDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AsyncMethodDataSourceDrivenTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,267 +7,212 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_AsyncMethodDataSourceDrivenTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("AsyncMethodDataSource_SingleValue", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("AsyncMethodDataSource_Tuples", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value1", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("AsyncMethodDataSource_Enumerable", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_3 = global::TUnit.Core.MethodMetadataFactory.Create("AsyncMethodDataSource_Func", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_4 = global::TUnit.Core.MethodMetadataFactory.Create("AsyncMethodDataSource_WithArguments", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_5 = global::TUnit.Core.MethodMetadataFactory.Create("AsyncMethodDataSource_ExternalClass", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_6 = global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskMethodDataSource_SingleValue", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests); - var metadata_AsyncMethodDataSource_SingleValue__int = global::TUnit.Core.TestMetadataFactory.Create( - "AsyncMethodDataSource_SingleValue", "AsyncMethodDataSource_SingleValue", 8, - __InvokeTest_AsyncMethodDataSource_SingleValue__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsyncMethodDataSource_SingleValue", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + return new global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - new global::TUnit.Core.MethodDataSourceAttribute("AsyncDataMethod") + case 0: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncDataMethod(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) + case 1: { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + return new global::System.Threading.Tasks.ValueTask(instance.AsyncMethodDataSource_SingleValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - var metadata_AsyncMethodDataSource_Tuples__int_string = global::TUnit.Core.TestMetadataFactory.Create( - "AsyncMethodDataSource_Tuples", "AsyncMethodDataSource_Tuples", 15, - __InvokeTest_AsyncMethodDataSource_Tuples__int_string, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsyncMethodDataSource_Tuples", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value1", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("AsyncDataMethodWithTuples") + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + case 1: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncDataMethodWithTuples(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) + case 2: { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + 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]))); } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } + default: + throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - var metadata_AsyncMethodDataSource_Enumerable__int = global::TUnit.Core.TestMetadataFactory.Create( - "AsyncMethodDataSource_Enumerable", "AsyncMethodDataSource_Enumerable", 23, - __InvokeTest_AsyncMethodDataSource_Enumerable__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsyncMethodDataSource_Enumerable", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("AsyncEnumerableDataMethod") + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + case 2: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncEnumerableDataMethod(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) + case 1: { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + return new global::System.Threading.Tasks.ValueTask(instance.AsyncMethodDataSource_Enumerable(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - var metadata_AsyncMethodDataSource_Func__int = global::TUnit.Core.TestMetadataFactory.Create( - "AsyncMethodDataSource_Func", "AsyncMethodDataSource_Func", 30, - __InvokeTest_AsyncMethodDataSource_Func__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsyncMethodDataSource_Func", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("AsyncFuncDataMethod") + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + case 3: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncFuncDataMethod(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) + case 1: { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + return new global::System.Threading.Tasks.ValueTask(instance.AsyncMethodDataSource_Func(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - var metadata_AsyncMethodDataSource_WithArguments__int = global::TUnit.Core.TestMetadataFactory.Create( - "AsyncMethodDataSource_WithArguments", "AsyncMethodDataSource_WithArguments", 37, - __InvokeTest_AsyncMethodDataSource_WithArguments__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsyncMethodDataSource_WithArguments", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("AsyncDataMethodWithArgs") + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + case 4: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncDataMethodWithArgs(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) + case 1: { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + return new global::System.Threading.Tasks.ValueTask(instance.AsyncMethodDataSource_WithArguments(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - var metadata_AsyncMethodDataSource_ExternalClass__string = global::TUnit.Core.TestMetadataFactory.Create( - "AsyncMethodDataSource_ExternalClass", "AsyncMethodDataSource_ExternalClass", 44, - __InvokeTest_AsyncMethodDataSource_ExternalClass__string, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsyncMethodDataSource_ExternalClass", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.AsyncExternalDataSource), "GetData") + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + case 5: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.AsyncExternalDataSource.GetData(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) + case 1: { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + return new global::System.Threading.Tasks.ValueTask(instance.AsyncMethodDataSource_ExternalClass(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - var metadata_ValueTaskMethodDataSource_SingleValue__int = global::TUnit.Core.TestMetadataFactory.Create( - "ValueTaskMethodDataSource_SingleValue", "ValueTaskMethodDataSource_SingleValue", 51, - __InvokeTest_ValueTaskMethodDataSource_SingleValue__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskMethodDataSource_SingleValue", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("ValueTaskDataMethod") + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + case 6: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests.ValueTaskDataMethod(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) + case 1: { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + return new global::System.Threading.Tasks.ValueTask(instance.ValueTaskMethodDataSource_SingleValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_AsyncMethodDataSource_SingleValue__int, metadata_AsyncMethodDataSource_Tuples__int_string, metadata_AsyncMethodDataSource_Enumerable__int, metadata_AsyncMethodDataSource_Func__int, metadata_AsyncMethodDataSource_WithArguments__int, metadata_AsyncMethodDataSource_ExternalClass__string, metadata_ValueTaskMethodDataSource_SingleValue__int }; + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_SingleValue", - ClassName = "AsyncMethodDataSourceDrivenTests", MethodName = "AsyncMethodDataSource_SingleValue", FullyQualifiedName = "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_SingleValue", FilePath = @"", @@ -277,12 +222,40 @@ internal static class TUnit_TestProject_AsyncMethodDataSourceDrivenTests__TestSo HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_AsyncMethodDataSource_SingleValue__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("AsyncDataMethod") + { + Factory = (dataGeneratorMetadata) => + { + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + { + var result = global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncDataMethod(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) + { + foreach (var item in enumerable) + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + } + } + else + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } + } + return Factory(); + } + }, +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_Tuples", - ClassName = "AsyncMethodDataSourceDrivenTests", MethodName = "AsyncMethodDataSource_Tuples", FullyQualifiedName = "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_Tuples", FilePath = @"", @@ -292,12 +265,40 @@ internal static class TUnit_TestProject_AsyncMethodDataSourceDrivenTests__TestSo HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_AsyncMethodDataSource_Tuples__int_string - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("AsyncDataMethodWithTuples") + { + Factory = (dataGeneratorMetadata) => + { + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + { + var result = global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncDataMethodWithTuples(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) + { + foreach (var item in enumerable) + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + } + } + else + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } + } + return Factory(); + } + }, +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_Enumerable", - ClassName = "AsyncMethodDataSourceDrivenTests", MethodName = "AsyncMethodDataSource_Enumerable", FullyQualifiedName = "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_Enumerable", FilePath = @"", @@ -307,12 +308,40 @@ internal static class TUnit_TestProject_AsyncMethodDataSourceDrivenTests__TestSo HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_AsyncMethodDataSource_Enumerable__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("AsyncEnumerableDataMethod") + { + Factory = (dataGeneratorMetadata) => + { + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + { + var result = global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncEnumerableDataMethod(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) + { + foreach (var item in enumerable) + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + } + } + else + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } + } + return Factory(); + } + }, +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_Func", - ClassName = "AsyncMethodDataSourceDrivenTests", MethodName = "AsyncMethodDataSource_Func", FullyQualifiedName = "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_Func", FilePath = @"", @@ -322,12 +351,40 @@ internal static class TUnit_TestProject_AsyncMethodDataSourceDrivenTests__TestSo HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_AsyncMethodDataSource_Func__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_3, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 3, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("AsyncFuncDataMethod") + { + Factory = (dataGeneratorMetadata) => + { + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + { + var result = global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncFuncDataMethod(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) + { + foreach (var item in enumerable) + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + } + } + else + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } + } + return Factory(); + } + }, +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_WithArguments", - ClassName = "AsyncMethodDataSourceDrivenTests", MethodName = "AsyncMethodDataSource_WithArguments", FullyQualifiedName = "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_WithArguments", FilePath = @"", @@ -337,537 +394,127 @@ internal static class TUnit_TestProject_AsyncMethodDataSourceDrivenTests__TestSo HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_AsyncMethodDataSource_WithArguments__int - }; - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_ExternalClass", - ClassName = "AsyncMethodDataSourceDrivenTests", - MethodName = "AsyncMethodDataSource_ExternalClass", - FullyQualifiedName = "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_ExternalClass", - FilePath = @"", - LineNumber = 44, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_AsyncMethodDataSource_ExternalClass__string - }; - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.ValueTaskMethodDataSource_SingleValue", - ClassName = "AsyncMethodDataSourceDrivenTests", - MethodName = "ValueTaskMethodDataSource_SingleValue", - FullyQualifiedName = "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.ValueTaskMethodDataSource_SingleValue", - FilePath = @"", - LineNumber = 51, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_ValueTaskMethodDataSource_SingleValue__int - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_AsyncMethodDataSource_SingleValue__int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_AsyncMethodDataSource_Tuples__int_string(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_AsyncMethodDataSource_Enumerable__int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_AsyncMethodDataSource_Func__int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_AsyncMethodDataSource_WithArguments__int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_AsyncMethodDataSource_ExternalClass__string(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_ValueTaskMethodDataSource_SingleValue__int(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsyncMethodDataSource_SingleValue__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "AsyncMethodDataSource_SingleValue", "AsyncMethodDataSource_SingleValue", 8, - __InvokeTest_AsyncMethodDataSource_SingleValue__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsyncMethodDataSource_SingleValue", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + MethodMetadata = __mm_4, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 4, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("AsyncDataMethodWithArgs") { - new global::TUnit.Core.MethodDataSourceAttribute("AsyncDataMethod") + Factory = (dataGeneratorMetadata) => { - Factory = (dataGeneratorMetadata) => + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + var result = global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncDataMethodWithArgs(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) { - var result = global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncDataMethod(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else + foreach (var item in enumerable) { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); } } - return Factory(); - } - }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsyncMethodDataSource_Tuples__int_string(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "AsyncMethodDataSource_Tuples", "AsyncMethodDataSource_Tuples", 15, - __InvokeTest_AsyncMethodDataSource_Tuples__int_string, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsyncMethodDataSource_Tuples", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value1", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("AsyncDataMethodWithTuples") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + else { - var result = global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncDataMethodWithTuples(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } - return Factory(); } - }, + return Factory(); + } }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsyncMethodDataSource_Enumerable__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "AsyncMethodDataSource_Enumerable", "AsyncMethodDataSource_Enumerable", 23, - __InvokeTest_AsyncMethodDataSource_Enumerable__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsyncMethodDataSource_Enumerable", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("AsyncEnumerableDataMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncEnumerableDataMethod(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } +}, }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsyncMethodDataSource_Func__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata + new global::TUnit.Core.TestEntry { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "AsyncMethodDataSource_Func", "AsyncMethodDataSource_Func", 30, - __InvokeTest_AsyncMethodDataSource_Func__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsyncMethodDataSource_Func", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + MethodName = "AsyncMethodDataSource_ExternalClass", + FullyQualifiedName = "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_ExternalClass", + FilePath = @"", + LineNumber = 44, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_5, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 5, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.AsyncExternalDataSource), "GetData") { - new global::TUnit.Core.MethodDataSourceAttribute("AsyncFuncDataMethod") + Factory = (dataGeneratorMetadata) => { - Factory = (dataGeneratorMetadata) => + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + var result = global::TUnit.TestProject.AsyncExternalDataSource.GetData(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) { - var result = global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncFuncDataMethod(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else + foreach (var item in enumerable) { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); } } - return Factory(); - } - }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsyncMethodDataSource_WithArguments__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "AsyncMethodDataSource_WithArguments", "AsyncMethodDataSource_WithArguments", 37, - __InvokeTest_AsyncMethodDataSource_WithArguments__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsyncMethodDataSource_WithArguments", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("AsyncDataMethodWithArgs") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + else { - var result = global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncDataMethodWithArgs(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } - return Factory(); } - }, + return Factory(); + } }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsyncMethodDataSource_ExternalClass__string(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata +}, + }, + new global::TUnit.Core.TestEntry { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "AsyncMethodDataSource_ExternalClass", "AsyncMethodDataSource_ExternalClass", 44, - __InvokeTest_AsyncMethodDataSource_ExternalClass__string, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsyncMethodDataSource_ExternalClass", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + MethodName = "ValueTaskMethodDataSource_SingleValue", + FullyQualifiedName = "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.ValueTaskMethodDataSource_SingleValue", + FilePath = @"", + LineNumber = 51, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_6, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 6, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("ValueTaskDataMethod") { - new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.AsyncExternalDataSource), "GetData") + Factory = (dataGeneratorMetadata) => { - Factory = (dataGeneratorMetadata) => + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + var result = global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests.ValueTaskDataMethod(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) { - var result = global::TUnit.TestProject.AsyncExternalDataSource.GetData(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else + foreach (var item in enumerable) { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); } } - return Factory(); - } - }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_ValueTaskMethodDataSource_SingleValue__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "ValueTaskMethodDataSource_SingleValue", "ValueTaskMethodDataSource_SingleValue", 51, - __InvokeTest_ValueTaskMethodDataSource_SingleValue__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskMethodDataSource_SingleValue", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("ValueTaskDataMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + else { - var result = global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests.ValueTaskDataMethod(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } - return Factory(); } - }, + return Factory(); + } }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests(); - } +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_AsyncMethodDataSourceDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), TUnit_TestProject_AsyncMethodDataSourceDrivenTests__TestSource.GetTests, TUnit_TestProject_AsyncMethodDataSourceDrivenTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_AsyncMethodDataSourceDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_AsyncMethodDataSourceDrivenTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/AttributeTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/AttributeTests.Test.verified.txt index 2f923e958c..0c18da3ad6 100644 --- a/TUnit.Core.SourceGenerator.Tests/AttributeTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AttributeTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,34 +7,74 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_AttributeTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AttributeTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AttributeTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.AttributeTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("MyTest", __classType, typeof(void), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.AttributeTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) + { + case 0: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.AttributeTests); - var metadata_MyTest = global::TUnit.Core.TestMetadataFactory.Create( - "MyTest", "MyTest", 7, - __InvokeTest_MyTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MyTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_MyTest }; + case 0: + { + 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,} + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.AttributeTests.MyTest", - ClassName = "AttributeTests", MethodName = "MyTest", FullyQualifiedName = "TUnit.TestProject.AttributeTests.MyTest", FilePath = @"", @@ -44,68 +84,16 @@ internal static class TUnit_TestProject_AttributeTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_MyTest - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - 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::System.Threading.Tasks.ValueTask __InvokeTest_MyTest(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_MyTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AttributeTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.AttributeTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "MyTest", "MyTest", 7, - __InvokeTest_MyTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MyTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.AttributeTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.AttributeTests(); - } + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_AttributeTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.AttributeTests), TUnit_TestProject_AttributeTests__TestSource.GetTests, TUnit_TestProject_AttributeTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_AttributeTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_AttributeTests__TestSource.Entries); } 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 541c2796f2..0aa3823183 100644 --- a/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet10_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet10_0.verified.txt @@ -7,46 +7,86 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_BasicTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.BasicTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.BasicTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata_SynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "SynchronousTest", "SynchronousTest", 5, - __InvokeTest_SynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - var metadata_AsynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "AsynchronousTest", "AsynchronousTest", 11, - __InvokeTest_AsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - var metadata_ValueTaskAsynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "ValueTaskAsynchronousTest", "ValueTaskAsynchronousTest", 17, - __InvokeTest_ValueTaskAsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_SynchronousTest, metadata_AsynchronousTest, metadata_ValueTaskAsynchronousTest }; + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: + { + try + { + return instance.ValueTaskAsynchronousTest(); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Attribute[] __Attributes(int groupIndex) { - yield return new global::TUnit.Core.TestDescriptor + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } + } + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.SynchronousTest", - ClassName = "BasicTests", MethodName = "SynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.SynchronousTest", FilePath = @"", @@ -56,12 +96,15 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_SynchronousTest - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", - ClassName = "BasicTests", MethodName = "AsynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", FilePath = @"", @@ -71,12 +114,15 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_AsynchronousTest - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - ClassName = "BasicTests", MethodName = "ValueTaskAsynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", FilePath = @"", @@ -86,122 +132,16 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_ValueTaskAsynchronousTest - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_SynchronousTest(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_AsynchronousTest(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_ValueTaskAsynchronousTest(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_SynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "SynchronousTest", "SynchronousTest", 5, - __InvokeTest_SynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "AsynchronousTest", "AsynchronousTest", 11, - __InvokeTest_AsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_ValueTaskAsynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "ValueTaskAsynchronousTest", "ValueTaskAsynchronousTest", 17, - __InvokeTest_ValueTaskAsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.BasicTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_BasicTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.BasicTests), TUnit_TestProject_BasicTests__TestSource.GetTests, TUnit_TestProject_BasicTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_BasicTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_BasicTests__TestSource.Entries); } 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 541c2796f2..0aa3823183 100644 --- a/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet8_0.verified.txt @@ -7,46 +7,86 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_BasicTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.BasicTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.BasicTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata_SynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "SynchronousTest", "SynchronousTest", 5, - __InvokeTest_SynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - var metadata_AsynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "AsynchronousTest", "AsynchronousTest", 11, - __InvokeTest_AsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - var metadata_ValueTaskAsynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "ValueTaskAsynchronousTest", "ValueTaskAsynchronousTest", 17, - __InvokeTest_ValueTaskAsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_SynchronousTest, metadata_AsynchronousTest, metadata_ValueTaskAsynchronousTest }; + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: + { + try + { + return instance.ValueTaskAsynchronousTest(); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Attribute[] __Attributes(int groupIndex) { - yield return new global::TUnit.Core.TestDescriptor + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } + } + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.SynchronousTest", - ClassName = "BasicTests", MethodName = "SynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.SynchronousTest", FilePath = @"", @@ -56,12 +96,15 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_SynchronousTest - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", - ClassName = "BasicTests", MethodName = "AsynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", FilePath = @"", @@ -71,12 +114,15 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_AsynchronousTest - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - ClassName = "BasicTests", MethodName = "ValueTaskAsynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", FilePath = @"", @@ -86,122 +132,16 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_ValueTaskAsynchronousTest - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_SynchronousTest(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_AsynchronousTest(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_ValueTaskAsynchronousTest(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_SynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "SynchronousTest", "SynchronousTest", 5, - __InvokeTest_SynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "AsynchronousTest", "AsynchronousTest", 11, - __InvokeTest_AsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_ValueTaskAsynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "ValueTaskAsynchronousTest", "ValueTaskAsynchronousTest", 17, - __InvokeTest_ValueTaskAsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.BasicTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_BasicTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.BasicTests), TUnit_TestProject_BasicTests__TestSource.GetTests, TUnit_TestProject_BasicTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_BasicTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_BasicTests__TestSource.Entries); } 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 541c2796f2..0aa3823183 100644 --- a/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet9_0.verified.txt @@ -7,46 +7,86 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_BasicTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.BasicTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.BasicTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata_SynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "SynchronousTest", "SynchronousTest", 5, - __InvokeTest_SynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - var metadata_AsynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "AsynchronousTest", "AsynchronousTest", 11, - __InvokeTest_AsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - var metadata_ValueTaskAsynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "ValueTaskAsynchronousTest", "ValueTaskAsynchronousTest", 17, - __InvokeTest_ValueTaskAsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_SynchronousTest, metadata_AsynchronousTest, metadata_ValueTaskAsynchronousTest }; + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: + { + try + { + return instance.ValueTaskAsynchronousTest(); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Attribute[] __Attributes(int groupIndex) { - yield return new global::TUnit.Core.TestDescriptor + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } + } + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.SynchronousTest", - ClassName = "BasicTests", MethodName = "SynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.SynchronousTest", FilePath = @"", @@ -56,12 +96,15 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_SynchronousTest - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", - ClassName = "BasicTests", MethodName = "AsynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", FilePath = @"", @@ -71,12 +114,15 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_AsynchronousTest - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - ClassName = "BasicTests", MethodName = "ValueTaskAsynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", FilePath = @"", @@ -86,122 +132,16 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_ValueTaskAsynchronousTest - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_SynchronousTest(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_AsynchronousTest(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_ValueTaskAsynchronousTest(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_SynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "SynchronousTest", "SynchronousTest", 5, - __InvokeTest_SynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "AsynchronousTest", "AsynchronousTest", 11, - __InvokeTest_AsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_ValueTaskAsynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "ValueTaskAsynchronousTest", "ValueTaskAsynchronousTest", 17, - __InvokeTest_ValueTaskAsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.BasicTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_BasicTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.BasicTests), TUnit_TestProject_BasicTests__TestSource.GetTests, TUnit_TestProject_BasicTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_BasicTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_BasicTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.Net4_7.verified.txt b/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.Net4_7.verified.txt index a791373b8c..d67d8a3266 100644 --- a/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.Net4_7.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.Net4_7.verified.txt @@ -7,46 +7,86 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_BasicTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.BasicTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.BasicTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata_SynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "SynchronousTest", "SynchronousTest", 5, - __InvokeTest_SynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - var metadata_AsynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "AsynchronousTest", "AsynchronousTest", 11, - __InvokeTest_AsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - var metadata_ValueTaskAsynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "ValueTaskAsynchronousTest", "ValueTaskAsynchronousTest", 17, - __InvokeTest_ValueTaskAsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_SynchronousTest, metadata_AsynchronousTest, metadata_ValueTaskAsynchronousTest }; + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: + { + try + { + return instance.ValueTaskAsynchronousTest(); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Attribute[] __Attributes(int groupIndex) { - yield return new global::TUnit.Core.TestDescriptor + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } + } + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.SynchronousTest", - ClassName = "BasicTests", MethodName = "SynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.SynchronousTest", FilePath = @"", @@ -56,12 +96,15 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_SynchronousTest - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", - ClassName = "BasicTests", MethodName = "AsynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", FilePath = @"", @@ -71,12 +114,15 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_AsynchronousTest - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - ClassName = "BasicTests", MethodName = "ValueTaskAsynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", FilePath = @"", @@ -86,122 +132,16 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_ValueTaskAsynchronousTest - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_SynchronousTest(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_AsynchronousTest(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_ValueTaskAsynchronousTest(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_SynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "SynchronousTest", "SynchronousTest", 5, - __InvokeTest_SynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "AsynchronousTest", "AsynchronousTest", 11, - __InvokeTest_AsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_ValueTaskAsynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "ValueTaskAsynchronousTest", "ValueTaskAsynchronousTest", 17, - __InvokeTest_ValueTaskAsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.BasicTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_BasicTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.BasicTests), TUnit_TestProject_BasicTests__TestSource.GetTests, TUnit_TestProject_BasicTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_BasicTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_BasicTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/BeforeAllTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/BeforeAllTests.Test.verified.txt index cd08cb2abf..c7cffd49d9 100644 --- a/TUnit.Core.SourceGenerator.Tests/BeforeAllTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/BeforeAllTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,40 +7,73 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_BeforeTests_SetupTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.BeforeTests.SetupTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Test1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("Test2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.BeforeTests.SetupTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.BeforeTests.SetupTests); - var metadata_Test1 = global::TUnit.Core.TestMetadataFactory.Create( - "Test1", "Test1", 98, - __InvokeTest_Test1, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - var metadata_Test2 = global::TUnit.Core.TestMetadataFactory.Create( - "Test2", "Test2", 104, - __InvokeTest_Test2, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_Test1, metadata_Test2 }; + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BeforeTests.SetupTests.Test1", - ClassName = "SetupTests", MethodName = "Test1", FullyQualifiedName = "TUnit.TestProject.BeforeTests.SetupTests.Test1", FilePath = @"", @@ -50,12 +83,15 @@ internal static class TUnit_TestProject_BeforeTests_SetupTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Test1 - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BeforeTests.SetupTests.Test2", - ClassName = "SetupTests", MethodName = "Test2", FullyQualifiedName = "TUnit.TestProject.BeforeTests.SetupTests.Test2", FilePath = @"", @@ -65,88 +101,16 @@ internal static class TUnit_TestProject_BeforeTests_SetupTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Test2 - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Test1(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Test2(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test1(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BeforeTests.SetupTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Test1", "Test1", 98, - __InvokeTest_Test1, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test2(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BeforeTests.SetupTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Test2", "Test2", 104, - __InvokeTest_Test2, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.BeforeTests.SetupTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BeforeTests.SetupTests(); - } + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_BeforeTests_SetupTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.BeforeTests.SetupTests), TUnit_TestProject_BeforeTests_SetupTests__TestSource.GetTests, TUnit_TestProject_BeforeTests_SetupTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_BeforeTests_SetupTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_BeforeTests_SetupTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/BeforeTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/BeforeTests.Test.verified.txt index cd08cb2abf..c7cffd49d9 100644 --- a/TUnit.Core.SourceGenerator.Tests/BeforeTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/BeforeTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,40 +7,73 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_BeforeTests_SetupTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.BeforeTests.SetupTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Test1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("Test2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.BeforeTests.SetupTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.BeforeTests.SetupTests); - var metadata_Test1 = global::TUnit.Core.TestMetadataFactory.Create( - "Test1", "Test1", 98, - __InvokeTest_Test1, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - var metadata_Test2 = global::TUnit.Core.TestMetadataFactory.Create( - "Test2", "Test2", 104, - __InvokeTest_Test2, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_Test1, metadata_Test2 }; + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BeforeTests.SetupTests.Test1", - ClassName = "SetupTests", MethodName = "Test1", FullyQualifiedName = "TUnit.TestProject.BeforeTests.SetupTests.Test1", FilePath = @"", @@ -50,12 +83,15 @@ internal static class TUnit_TestProject_BeforeTests_SetupTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Test1 - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BeforeTests.SetupTests.Test2", - ClassName = "SetupTests", MethodName = "Test2", FullyQualifiedName = "TUnit.TestProject.BeforeTests.SetupTests.Test2", FilePath = @"", @@ -65,88 +101,16 @@ internal static class TUnit_TestProject_BeforeTests_SetupTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Test2 - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Test1(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Test2(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test1(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BeforeTests.SetupTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Test1", "Test1", 98, - __InvokeTest_Test1, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test2(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BeforeTests.SetupTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BeforeTests.SetupTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Test2", "Test2", 104, - __InvokeTest_Test2, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.BeforeTests.SetupTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BeforeTests.SetupTests(); - } + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_BeforeTests_SetupTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.BeforeTests.SetupTests), TUnit_TestProject_BeforeTests_SetupTests__TestSource.GetTests, TUnit_TestProject_BeforeTests_SetupTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_BeforeTests_SetupTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_BeforeTests_SetupTests__TestSource.Entries); } 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 33bd089a01..5b74b505a1 100644 --- a/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet10_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet10_0.verified.txt @@ -7,34 +7,63 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_Bugs__2971_Tests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2971.Tests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2971.Tests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._2971.Tests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("SimpleTest", __classType, typeof(void), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.Bugs._2971.Tests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) + { + case 0: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._2971.Tests); - var metadata_SimpleTest = global::TUnit.Core.TestMetadataFactory.Create( - "SimpleTest", "SimpleTest", 19, - __InvokeTest_SimpleTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SimpleTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_SimpleTest }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Bugs._2971.SomeAttribute(typeof(global::System.Nullable<>)) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.Bugs._2971.Tests.SimpleTest", - ClassName = "Tests", MethodName = "SimpleTest", FullyQualifiedName = "TUnit.TestProject.Bugs._2971.Tests.SimpleTest", FilePath = @"", @@ -44,57 +73,16 @@ internal static class TUnit_TestProject_Bugs__2971_Tests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_SimpleTest - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Bugs._2971.SomeAttribute(typeof(global::System.Nullable<>)) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_SimpleTest(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_SimpleTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2971.Tests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._2971.Tests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "SimpleTest", "SimpleTest", 19, - __InvokeTest_SimpleTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SimpleTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.Bugs._2971.Tests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.Bugs._2971.Tests(); - } + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__2971_Tests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._2971.Tests), TUnit_TestProject_Bugs__2971_Tests__TestSource.GetTests, TUnit_TestProject_Bugs__2971_Tests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_Bugs__2971_Tests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__2971_Tests__TestSource.Entries); } 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 33bd089a01..5b74b505a1 100644 --- a/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet8_0.verified.txt @@ -7,34 +7,63 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_Bugs__2971_Tests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2971.Tests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2971.Tests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._2971.Tests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("SimpleTest", __classType, typeof(void), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.Bugs._2971.Tests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) + { + case 0: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._2971.Tests); - var metadata_SimpleTest = global::TUnit.Core.TestMetadataFactory.Create( - "SimpleTest", "SimpleTest", 19, - __InvokeTest_SimpleTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SimpleTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_SimpleTest }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Bugs._2971.SomeAttribute(typeof(global::System.Nullable<>)) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.Bugs._2971.Tests.SimpleTest", - ClassName = "Tests", MethodName = "SimpleTest", FullyQualifiedName = "TUnit.TestProject.Bugs._2971.Tests.SimpleTest", FilePath = @"", @@ -44,57 +73,16 @@ internal static class TUnit_TestProject_Bugs__2971_Tests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_SimpleTest - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Bugs._2971.SomeAttribute(typeof(global::System.Nullable<>)) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_SimpleTest(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_SimpleTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2971.Tests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._2971.Tests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "SimpleTest", "SimpleTest", 19, - __InvokeTest_SimpleTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SimpleTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.Bugs._2971.Tests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.Bugs._2971.Tests(); - } + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__2971_Tests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._2971.Tests), TUnit_TestProject_Bugs__2971_Tests__TestSource.GetTests, TUnit_TestProject_Bugs__2971_Tests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_Bugs__2971_Tests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__2971_Tests__TestSource.Entries); } 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 33bd089a01..5b74b505a1 100644 --- a/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet9_0.verified.txt @@ -7,34 +7,63 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_Bugs__2971_Tests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2971.Tests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2971.Tests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._2971.Tests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("SimpleTest", __classType, typeof(void), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.Bugs._2971.Tests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) + { + case 0: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._2971.Tests); - var metadata_SimpleTest = global::TUnit.Core.TestMetadataFactory.Create( - "SimpleTest", "SimpleTest", 19, - __InvokeTest_SimpleTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SimpleTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_SimpleTest }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Bugs._2971.SomeAttribute(typeof(global::System.Nullable<>)) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.Bugs._2971.Tests.SimpleTest", - ClassName = "Tests", MethodName = "SimpleTest", FullyQualifiedName = "TUnit.TestProject.Bugs._2971.Tests.SimpleTest", FilePath = @"", @@ -44,57 +73,16 @@ internal static class TUnit_TestProject_Bugs__2971_Tests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_SimpleTest - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Bugs._2971.SomeAttribute(typeof(global::System.Nullable<>)) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_SimpleTest(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_SimpleTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2971.Tests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._2971.Tests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "SimpleTest", "SimpleTest", 19, - __InvokeTest_SimpleTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SimpleTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.Bugs._2971.Tests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.Bugs._2971.Tests(); - } + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__2971_Tests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._2971.Tests), TUnit_TestProject_Bugs__2971_Tests__TestSource.GetTests, TUnit_TestProject_Bugs__2971_Tests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_Bugs__2971_Tests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__2971_Tests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.Net4_7.verified.txt b/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.Net4_7.verified.txt index ade39c0db1..897e0f1362 100644 --- a/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.Net4_7.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.Net4_7.verified.txt @@ -7,34 +7,63 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_Bugs__2971_Tests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2971.Tests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2971.Tests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._2971.Tests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("SimpleTest", __classType, typeof(void), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.Bugs._2971.Tests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) + { + case 0: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._2971.Tests); - var metadata_SimpleTest = global::TUnit.Core.TestMetadataFactory.Create( - "SimpleTest", "SimpleTest", 19, - __InvokeTest_SimpleTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SimpleTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_SimpleTest }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Bugs._2971.SomeAttribute(typeof(global::System.Nullable<>)) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.Bugs._2971.Tests.SimpleTest", - ClassName = "Tests", MethodName = "SimpleTest", FullyQualifiedName = "TUnit.TestProject.Bugs._2971.Tests.SimpleTest", FilePath = @"", @@ -44,57 +73,16 @@ internal static class TUnit_TestProject_Bugs__2971_Tests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_SimpleTest - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Bugs._2971.SomeAttribute(typeof(global::System.Nullable<>)) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_SimpleTest(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_SimpleTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2971.Tests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._2971.Tests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "SimpleTest", "SimpleTest", 19, - __InvokeTest_SimpleTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SimpleTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.Bugs._2971.Tests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.Bugs._2971.Tests(); - } + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__2971_Tests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._2971.Tests), TUnit_TestProject_Bugs__2971_Tests__TestSource.GetTests, TUnit_TestProject_Bugs__2971_Tests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_Bugs__2971_Tests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__2971_Tests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/ClassAndMethodArgumentsTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassAndMethodArgumentsTests.Test.verified.txt index 915f45d724..2abf9e98ab 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassAndMethodArgumentsTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ClassAndMethodArgumentsTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,80 +7,112 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_ClassAndMethodArgumentsTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassAndMethodArgumentsTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassAndMethodArgumentsTests", 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", "TestsBase`1"), - Parameters = new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "arg1", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetConstructor(new global::System.Type[] { typeof(string) })!.GetParameters()[0]) - }, - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests); - var metadata_Simple = global::TUnit.Core.TestMetadataFactory.Create( - "Simple", "Simple", 8, - __InvokeTest_Simple, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Simple", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("1"), - new global::TUnit.Core.ArgumentsAttribute("2"), - }, - testSessionId: testSessionId - ); - var metadata_WithMethodLevel__string = global::TUnit.Core.TestMetadataFactory.Create( - "WithMethodLevel", "WithMethodLevel", 11, - __InvokeTest_WithMethodLevel__string, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("WithMethodLevel", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "arg2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("3"), - new global::TUnit.Core.ArgumentsAttribute("4"), - }, - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("1"), - new global::TUnit.Core.ArgumentsAttribute("2"), + global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "arg1", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetConstructor(new global::System.Type[] { typeof(string) })!.GetParameters()[0]) }, - testSessionId: testSessionId - ); - var metadata_IgnoreParameters__string = global::TUnit.Core.TestMetadataFactory.Create( - "IgnoreParameters", "IgnoreParameters", 16, - __InvokeTest_IgnoreParameters__string, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("IgnoreParameters", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "arg2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Simple", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("WithMethodLevel", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "arg2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("IgnoreParameters", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "arg2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) +}); + 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 __Invoke(global::TUnit.TestProject.ClassAndMethodArgumentsTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - new global::TUnit.Core.ArgumentsAttribute("3"), - new global::TUnit.Core.ArgumentsAttribute("4"), - }, - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - new global::TUnit.Core.ArgumentsAttribute("1"), - new global::TUnit.Core.ArgumentsAttribute("2"), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_Simple, metadata_WithMethodLevel__string, metadata_IgnoreParameters__string }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.ArgumentsAttribute("1"), + new global::TUnit.Core.ArgumentsAttribute("2") + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.ClassAndMethodArgumentsTests.Simple", - ClassName = "ClassAndMethodArgumentsTests", MethodName = "Simple", FullyQualifiedName = "TUnit.TestProject.ClassAndMethodArgumentsTests.Simple", FilePath = @"", @@ -90,12 +122,20 @@ internal static class TUnit_TestProject_ClassAndMethodArgumentsTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Simple - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute("1"), + new global::TUnit.Core.ArgumentsAttribute("2"), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.ClassAndMethodArgumentsTests.WithMethodLevel", - ClassName = "ClassAndMethodArgumentsTests", MethodName = "WithMethodLevel", FullyQualifiedName = "TUnit.TestProject.ClassAndMethodArgumentsTests.WithMethodLevel", FilePath = @"", @@ -105,12 +145,25 @@ internal static class TUnit_TestProject_ClassAndMethodArgumentsTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_WithMethodLevel__string - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute("3"), + new global::TUnit.Core.ArgumentsAttribute("4"), +}, + ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute("1"), + new global::TUnit.Core.ArgumentsAttribute("2"), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.ClassAndMethodArgumentsTests.IgnoreParameters", - ClassName = "ClassAndMethodArgumentsTests", MethodName = "IgnoreParameters", FullyQualifiedName = "TUnit.TestProject.ClassAndMethodArgumentsTests.IgnoreParameters", FilePath = @"", @@ -120,179 +173,26 @@ internal static class TUnit_TestProject_ClassAndMethodArgumentsTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_IgnoreParameters__string - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.ArgumentsAttribute("1"), - new global::TUnit.Core.ArgumentsAttribute("2") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Simple(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_WithMethodLevel__string(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_IgnoreParameters__string(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Simple(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassAndMethodArgumentsTests", 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[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "arg1", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetConstructor(new global::System.Type[] { typeof(string) })!.GetParameters()[0]) - }, - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Simple", "Simple", 8, - __InvokeTest_Simple, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Simple", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("1"), - new global::TUnit.Core.ArgumentsAttribute("2"), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_WithMethodLevel__string(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassAndMethodArgumentsTests", 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[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "arg1", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetConstructor(new global::System.Type[] { typeof(string) })!.GetParameters()[0]) - }, - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "WithMethodLevel", "WithMethodLevel", 11, - __InvokeTest_WithMethodLevel__string, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("WithMethodLevel", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "arg2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("3"), - new global::TUnit.Core.ArgumentsAttribute("4"), - }, - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("1"), - new global::TUnit.Core.ArgumentsAttribute("2"), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_IgnoreParameters__string(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassAndMethodArgumentsTests", 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[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "arg1", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetConstructor(new global::System.Type[] { typeof(string) })!.GetParameters()[0]) - }, - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "IgnoreParameters", "IgnoreParameters", 16, - __InvokeTest_IgnoreParameters__string, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("IgnoreParameters", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "arg2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("3"), - new global::TUnit.Core.ArgumentsAttribute("4"), - }, - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("1"), - new global::TUnit.Core.ArgumentsAttribute("2"), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal 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])); - } + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute("3"), + new global::TUnit.Core.ArgumentsAttribute("4"), +}, + ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute("1"), + new global::TUnit.Core.ArgumentsAttribute("2"), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_ClassAndMethodArgumentsTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), TUnit_TestProject_ClassAndMethodArgumentsTests__TestSource.GetTests, TUnit_TestProject_ClassAndMethodArgumentsTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_ClassAndMethodArgumentsTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_ClassAndMethodArgumentsTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/ClassConstructorTest.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassConstructorTest.Test.verified.txt index 0f027d8923..8dab10fd1e 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassConstructorTest.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ClassConstructorTest.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,50 +7,80 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_ClassConstructorTest__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassConstructorTest", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassConstructorTest", 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", "TestsBase`1"), - Parameters = new global::TUnit.Core.ParameterMetadata[] + global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.DummyReferenceTypeClass), "dummyReferenceTypeClass", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DummyReferenceTypeClass)), false, reflectionInfoFactory: static () => 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 { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.DummyReferenceTypeClass), "dummyReferenceTypeClass", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DummyReferenceTypeClass)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.ClassConstructorTest).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.DummyReferenceTypeClass) })!.GetParameters()[0]) - }, - Properties = 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.ClassConstructorTest); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Test", __classType, typeof(void), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.ClassConstructorTest instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) + { + case 0: { - new global::TUnit.Core.PropertyMetadata + try + { + instance.Test(); + return default(global::System.Threading.Tasks.ValueTask); + } + catch (global::System.Exception ex) { - 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! + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } - }, - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.ClassConstructorTest); - var metadata_Test = global::TUnit.Core.TestMetadataFactory.Create( - "Test", "Test", 8, - __InvokeTest_Test, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_Test }; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Attribute[] __Attributes(int groupIndex) { - yield return new global::TUnit.Core.TestDescriptor + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.ClassConstructorAttribute() + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } + } + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.ClassConstructorTest.Test", - ClassName = "ClassConstructorTest", MethodName = "Test", FullyQualifiedName = "TUnit.TestProject.ClassConstructorTest.Test", FilePath = @"", @@ -60,74 +90,16 @@ internal static class TUnit_TestProject_ClassConstructorTest__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Test - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.ClassConstructorAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Test(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassConstructorTest", 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[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.DummyReferenceTypeClass), "dummyReferenceTypeClass", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DummyReferenceTypeClass)), false, reflectionInfoFactory: static () => 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 - }); - var __classType = typeof(global::TUnit.TestProject.ClassConstructorTest); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Test", "Test", 8, - __InvokeTest_Test, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal 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"); - } + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_ClassConstructorTest__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.ClassConstructorTest), TUnit_TestProject_ClassConstructorTest__TestSource.GetTests, TUnit_TestProject_ClassConstructorTest__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_ClassConstructorTest__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_ClassConstructorTest__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests.Test.verified.txt index a9a6eb7e43..785f3f8c91 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,129 +7,223 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_ClassDataSourceDrivenTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Class", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass), "value", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Class_Generic", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass), "value", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("IsInitialized_With_1_ClassDataSource", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class1", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_3 = global::TUnit.Core.MethodMetadataFactory.Create("IsInitialized_With_2_ClassDataSources", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class1", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class2", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_4 = global::TUnit.Core.MethodMetadataFactory.Create("IsInitialized_With_3_ClassDataSources", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class1", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class2", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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()[1]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class3", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_5 = global::TUnit.Core.MethodMetadataFactory.Create("IsInitialized_With_4_ClassDataSources", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class1", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class2", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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()[1]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class3", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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()[2]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class4", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_6 = global::TUnit.Core.MethodMetadataFactory.Create("IsInitialized_With_5_ClassDataSources", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class1", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class2", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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()[1]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class3", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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()[2]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class4", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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()[3]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class5", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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]) +}); + private static global::TUnit.TestProject.ClassDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests); - var metadata_DataSource_Class__SomeAsyncDisposableClass = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Class", "DataSource_Class", 9, - __InvokeTest_DataSource_Class__SomeAsyncDisposableClass, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Class", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass), "value", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ClassDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_DataSource_Class_Generic__SomeAsyncDisposableClass = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Class_Generic", "DataSource_Class_Generic", 16, - __InvokeTest_DataSource_Class_Generic__SomeAsyncDisposableClass, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Class_Generic", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass), "value", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ClassDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_IsInitialized_With_1_ClassDataSource__InitializableClass = global::TUnit.Core.TestMetadataFactory.Create( - "IsInitialized_With_1_ClassDataSource", "IsInitialized_With_1_ClassDataSource", 23, - __InvokeTest_IsInitialized_With_1_ClassDataSource__InitializableClass, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("IsInitialized_With_1_ClassDataSource", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class1", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ClassDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_IsInitialized_With_2_ClassDataSources__InitializableClass_InitializableClass = global::TUnit.Core.TestMetadataFactory.Create( - "IsInitialized_With_2_ClassDataSources", "IsInitialized_With_2_ClassDataSources", 30, - __InvokeTest_IsInitialized_With_2_ClassDataSources__InitializableClass_InitializableClass, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("IsInitialized_With_2_ClassDataSources", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class1", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class2", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ClassDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_IsInitialized_With_3_ClassDataSources__InitializableClass_InitializableClass_InitializableClass = global::TUnit.Core.TestMetadataFactory.Create( - "IsInitialized_With_3_ClassDataSources", "IsInitialized_With_3_ClassDataSources", 38, - __InvokeTest_IsInitialized_With_3_ClassDataSources__InitializableClass_InitializableClass_InitializableClass, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("IsInitialized_With_3_ClassDataSources", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class1", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class2", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class3", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ClassDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_IsInitialized_With_4_ClassDataSources__InitializableClass_InitializableClass_InitializableClass_InitializableClass = global::TUnit.Core.TestMetadataFactory.Create( - "IsInitialized_With_4_ClassDataSources", "IsInitialized_With_4_ClassDataSources", 47, - __InvokeTest_IsInitialized_With_4_ClassDataSources__InitializableClass_InitializableClass_InitializableClass_InitializableClass, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("IsInitialized_With_4_ClassDataSources", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class1", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class2", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class3", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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()[2]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class4", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ClassDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_IsInitialized_With_5_ClassDataSources__InitializableClass_InitializableClass_InitializableClass_InitializableClass_InitializableClass = global::TUnit.Core.TestMetadataFactory.Create( - "IsInitialized_With_5_ClassDataSources", "IsInitialized_With_5_ClassDataSources", 57, - __InvokeTest_IsInitialized_With_5_ClassDataSources__InitializableClass_InitializableClass_InitializableClass_InitializableClass_InitializableClass, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("IsInitialized_With_5_ClassDataSources", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] + return new global::TUnit.TestProject.ClassDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke(global::TUnit.TestProject.ClassDataSourceDrivenTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class1", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class2", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class3", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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()[2]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class4", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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()[3]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class5", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: + { + 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)); + } + } + case 3: + { + 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)); + } + } + case 4: + { + 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)); + } + } + case 5: + { + 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)); + } + } + case 6: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - new global::TUnit.Core.ClassDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_DataSource_Class__SomeAsyncDisposableClass, metadata_DataSource_Class_Generic__SomeAsyncDisposableClass, metadata_IsInitialized_With_1_ClassDataSource__InitializableClass, metadata_IsInitialized_With_2_ClassDataSources__InitializableClass_InitializableClass, metadata_IsInitialized_With_3_ClassDataSources__InitializableClass_InitializableClass_InitializableClass, metadata_IsInitialized_With_4_ClassDataSources__InitializableClass_InitializableClass_InitializableClass_InitializableClass, metadata_IsInitialized_With_5_ClassDataSources__InitializableClass_InitializableClass_InitializableClass_InitializableClass_InitializableClass }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.ClassDataSourceDrivenTests.DataSource_Class", - ClassName = "ClassDataSourceDrivenTests", MethodName = "DataSource_Class", FullyQualifiedName = "TUnit.TestProject.ClassDataSourceDrivenTests.DataSource_Class", FilePath = @"", @@ -139,12 +233,19 @@ internal static class TUnit_TestProject_ClassDataSourceDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_Class__SomeAsyncDisposableClass - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ClassDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.ClassDataSourceDrivenTests.DataSource_Class_Generic", - ClassName = "ClassDataSourceDrivenTests", MethodName = "DataSource_Class_Generic", FullyQualifiedName = "TUnit.TestProject.ClassDataSourceDrivenTests.DataSource_Class_Generic", FilePath = @"", @@ -154,12 +255,19 @@ internal static class TUnit_TestProject_ClassDataSourceDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_Class_Generic__SomeAsyncDisposableClass - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ClassDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_1_ClassDataSource", - ClassName = "ClassDataSourceDrivenTests", MethodName = "IsInitialized_With_1_ClassDataSource", FullyQualifiedName = "TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_1_ClassDataSource", FilePath = @"", @@ -169,12 +277,19 @@ internal static class TUnit_TestProject_ClassDataSourceDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_IsInitialized_With_1_ClassDataSource__InitializableClass - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ClassDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_2_ClassDataSources", - ClassName = "ClassDataSourceDrivenTests", MethodName = "IsInitialized_With_2_ClassDataSources", FullyQualifiedName = "TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_2_ClassDataSources", FilePath = @"", @@ -184,12 +299,19 @@ internal static class TUnit_TestProject_ClassDataSourceDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_IsInitialized_With_2_ClassDataSources__InitializableClass_InitializableClass - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_3, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 3, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ClassDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_3_ClassDataSources", - ClassName = "ClassDataSourceDrivenTests", MethodName = "IsInitialized_With_3_ClassDataSources", FullyQualifiedName = "TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_3_ClassDataSources", FilePath = @"", @@ -199,12 +321,19 @@ internal static class TUnit_TestProject_ClassDataSourceDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_IsInitialized_With_3_ClassDataSources__InitializableClass_InitializableClass_InitializableClass - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_4, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 4, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ClassDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_4_ClassDataSources", - ClassName = "ClassDataSourceDrivenTests", MethodName = "IsInitialized_With_4_ClassDataSources", FullyQualifiedName = "TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_4_ClassDataSources", FilePath = @"", @@ -214,12 +343,19 @@ internal static class TUnit_TestProject_ClassDataSourceDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_IsInitialized_With_4_ClassDataSources__InitializableClass_InitializableClass_InitializableClass_InitializableClass - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_5, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 5, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ClassDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_5_ClassDataSources", - ClassName = "ClassDataSourceDrivenTests", MethodName = "IsInitialized_With_5_ClassDataSources", FullyQualifiedName = "TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_5_ClassDataSources", FilePath = @"", @@ -229,371 +365,20 @@ internal static class TUnit_TestProject_ClassDataSourceDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_IsInitialized_With_5_ClassDataSources__InitializableClass_InitializableClass_InitializableClass_InitializableClass_InitializableClass - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Class__SomeAsyncDisposableClass(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Class_Generic__SomeAsyncDisposableClass(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_IsInitialized_With_1_ClassDataSource__InitializableClass(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_IsInitialized_With_2_ClassDataSources__InitializableClass_InitializableClass(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_IsInitialized_With_3_ClassDataSources__InitializableClass_InitializableClass_InitializableClass(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_IsInitialized_With_4_ClassDataSources__InitializableClass_InitializableClass_InitializableClass_InitializableClass(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_IsInitialized_With_5_ClassDataSources__InitializableClass_InitializableClass_InitializableClass_InitializableClass_InitializableClass(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Class__SomeAsyncDisposableClass(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Class", "DataSource_Class", 9, - __InvokeTest_DataSource_Class__SomeAsyncDisposableClass, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Class", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass), "value", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ClassDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Class_Generic__SomeAsyncDisposableClass(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Class_Generic", "DataSource_Class_Generic", 16, - __InvokeTest_DataSource_Class_Generic__SomeAsyncDisposableClass, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Class_Generic", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass), "value", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ClassDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_IsInitialized_With_1_ClassDataSource__InitializableClass(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "IsInitialized_With_1_ClassDataSource", "IsInitialized_With_1_ClassDataSource", 23, - __InvokeTest_IsInitialized_With_1_ClassDataSource__InitializableClass, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("IsInitialized_With_1_ClassDataSource", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class1", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ClassDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_IsInitialized_With_2_ClassDataSources__InitializableClass_InitializableClass(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "IsInitialized_With_2_ClassDataSources", "IsInitialized_With_2_ClassDataSources", 30, - __InvokeTest_IsInitialized_With_2_ClassDataSources__InitializableClass_InitializableClass, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("IsInitialized_With_2_ClassDataSources", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class1", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class2", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ClassDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_IsInitialized_With_3_ClassDataSources__InitializableClass_InitializableClass_InitializableClass(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "IsInitialized_With_3_ClassDataSources", "IsInitialized_With_3_ClassDataSources", 38, - __InvokeTest_IsInitialized_With_3_ClassDataSources__InitializableClass_InitializableClass_InitializableClass, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("IsInitialized_With_3_ClassDataSources", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class1", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class2", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class3", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ClassDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_IsInitialized_With_4_ClassDataSources__InitializableClass_InitializableClass_InitializableClass_InitializableClass(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "IsInitialized_With_4_ClassDataSources", "IsInitialized_With_4_ClassDataSources", 47, - __InvokeTest_IsInitialized_With_4_ClassDataSources__InitializableClass_InitializableClass_InitializableClass_InitializableClass, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("IsInitialized_With_4_ClassDataSources", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class1", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class2", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class3", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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()[2]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class4", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ClassDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_IsInitialized_With_5_ClassDataSources__InitializableClass_InitializableClass_InitializableClass_InitializableClass_InitializableClass(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "IsInitialized_With_5_ClassDataSources", "IsInitialized_With_5_ClassDataSources", 57, - __InvokeTest_IsInitialized_With_5_ClassDataSources__InitializableClass_InitializableClass_InitializableClass_InitializableClass_InitializableClass, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("IsInitialized_With_5_ClassDataSources", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class1", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class2", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class3", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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()[2]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class4", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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()[3]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.InitializableClass), "class5", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ClassDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.ClassDataSourceDrivenTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.ClassDataSourceDrivenTests(); - } + MethodMetadata = __mm_6, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 6, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ClassDataSourceAttribute(), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_ClassDataSourceDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), TUnit_TestProject_ClassDataSourceDrivenTests__TestSource.GetTests, TUnit_TestProject_ClassDataSourceDrivenTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_ClassDataSourceDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_ClassDataSourceDrivenTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests2.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests2.Test.verified.txt index 52d98dfbfc..73a74b02f0 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests2.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests2.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,53 +7,81 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_ClassDataSourceDrivenTests2__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests2", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests2", 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", "TestsBase`1"), - Parameters = new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2.Base), "base", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2.Base)), false, reflectionInfoFactory: static () => 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 - }); - var __classType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2); - var metadata_Base_Derived1 = global::TUnit.Core.TestMetadataFactory.Create( - "Base_Derived1", "Base_Derived1", 12, - __InvokeTest_Base_Derived1, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Base_Derived1", __classType, typeof(void), __classMetadata), - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ClassDataSourceAttribute(), - new global::TUnit.Core.ClassDataSourceAttribute(), + global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2.Base), "base", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2.Base)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2.Base) })!.GetParameters()[0]) }, - testSessionId: testSessionId - ); - var metadata_Base_Derived2 = global::TUnit.Core.TestMetadataFactory.Create( - "Base_Derived2", "Base_Derived2", 18, - __InvokeTest_Base_Derived2, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Base_Derived2", __classType, typeof(void), __classMetadata), - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Base_Derived1", __classType, typeof(void), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("Base_Derived2", __classType, typeof(void), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.ClassDataSourceDrivenTests2 instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - new global::TUnit.Core.ClassDataSourceAttribute(), - new global::TUnit.Core.ClassDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_Base_Derived1, metadata_Base_Derived2 }; + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) + { + case 0: + { + 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() + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.ClassDataSourceDrivenTests2.Base_Derived1", - ClassName = "ClassDataSourceDrivenTests2", MethodName = "Base_Derived1", FullyQualifiedName = "TUnit.TestProject.ClassDataSourceDrivenTests2.Base_Derived1", FilePath = @"", @@ -63,12 +91,20 @@ internal static class TUnit_TestProject_ClassDataSourceDrivenTests2__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Base_Derived1 - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ClassDataSourceAttribute(), + new global::TUnit.Core.ClassDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.ClassDataSourceDrivenTests2.Base_Derived2", - ClassName = "ClassDataSourceDrivenTests2", MethodName = "Base_Derived2", FullyQualifiedName = "TUnit.TestProject.ClassDataSourceDrivenTests2.Base_Derived2", FilePath = @"", @@ -78,109 +114,21 @@ internal static class TUnit_TestProject_ClassDataSourceDrivenTests2__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Base_Derived2 - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - 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::System.Threading.Tasks.ValueTask __InvokeTest_Base_Derived1(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Base_Derived2(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Base_Derived1(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests2", 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[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2.Base), "base", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2.Base)), false, reflectionInfoFactory: static () => 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 - }); - var __classType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Base_Derived1", "Base_Derived1", 12, - __InvokeTest_Base_Derived1, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Base_Derived1", __classType, typeof(void), __classMetadata), - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ClassDataSourceAttribute(), - new global::TUnit.Core.ClassDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Base_Derived2(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests2", 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[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2.Base), "base", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2.Base)), false, reflectionInfoFactory: static () => 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 - }); - var __classType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Base_Derived2", "Base_Derived2", 18, - __InvokeTest_Base_Derived2, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Base_Derived2", __classType, typeof(void), __classMetadata), - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ClassDataSourceAttribute(), - new global::TUnit.Core.ClassDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal 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])); - } + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ClassDataSourceAttribute(), + new global::TUnit.Core.ClassDataSourceAttribute(), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_ClassDataSourceDrivenTests2__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2), TUnit_TestProject_ClassDataSourceDrivenTests2__TestSource.GetTests, TUnit_TestProject_ClassDataSourceDrivenTests2__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_ClassDataSourceDrivenTests2__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_ClassDataSourceDrivenTests2__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTestsSharedKeyed.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTestsSharedKeyed.Test.verified.txt index fb4233e256..8c9658f830 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTestsSharedKeyed.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTestsSharedKeyed.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,56 +7,98 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed); - var metadata_DataSource_Class__SomeAsyncDisposableClass = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Class", "DataSource_Class", 9, - __InvokeTest_DataSource_Class__SomeAsyncDisposableClass, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Class", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass), "value", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ClassDataSourceAttribute() - {Shared = global::TUnit.Core.SharedType.Keyed,Key = "🔑",}, - }, - testSessionId: testSessionId - ); - var metadata_DataSource_Class_Generic__SomeAsyncDisposableClass = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Class_Generic", "DataSource_Class_Generic", 16, - __InvokeTest_DataSource_Class_Generic__SomeAsyncDisposableClass, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Class_Generic", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Class", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass), "value", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Class_Generic", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass), "value", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass)), false, reflectionInfoFactory: static () => 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]) +}); + 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 __Invoke(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass), "value", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - new global::TUnit.Core.ClassDataSourceAttribute() - {Shared = global::TUnit.Core.SharedType.Keyed,Key = "🔑",}, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_DataSource_Class__SomeAsyncDisposableClass, metadata_DataSource_Class_Generic__SomeAsyncDisposableClass }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed.DataSource_Class", - ClassName = "ClassDataSourceDrivenTestsSharedKeyed", MethodName = "DataSource_Class", FullyQualifiedName = "TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed.DataSource_Class", FilePath = @"", @@ -66,12 +108,20 @@ internal static class TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed__T HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_Class__SomeAsyncDisposableClass - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ClassDataSourceAttribute() +{Shared = global::TUnit.Core.SharedType.Keyed,Key = "🔑",}, +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed.DataSource_Class_Generic", - ClassName = "ClassDataSourceDrivenTestsSharedKeyed", MethodName = "DataSource_Class_Generic", FullyQualifiedName = "TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed.DataSource_Class_Generic", FilePath = @"", @@ -81,123 +131,21 @@ internal static class TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed__T HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_Class_Generic__SomeAsyncDisposableClass - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Class__SomeAsyncDisposableClass(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Class_Generic__SomeAsyncDisposableClass(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Class__SomeAsyncDisposableClass(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Class", "DataSource_Class", 9, - __InvokeTest_DataSource_Class__SomeAsyncDisposableClass, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Class", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass), "value", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ClassDataSourceAttribute() - {Shared = global::TUnit.Core.SharedType.Keyed,Key = "🔑",}, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Class_Generic__SomeAsyncDisposableClass(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Class_Generic", "DataSource_Class_Generic", 16, - __InvokeTest_DataSource_Class_Generic__SomeAsyncDisposableClass, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Class_Generic", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass), "value", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ClassDataSourceAttribute() - {Shared = global::TUnit.Core.SharedType.Keyed,Key = "🔑",}, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed(); - } + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ClassDataSourceAttribute() +{Shared = global::TUnit.Core.SharedType.Keyed,Key = "🔑",}, +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed), TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed__TestSource.GetTests, TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.Test.verified.txt index b37b1a5fe7..9fb131d652 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -17,282 +17,135 @@ internal static class TUnit_TestProject_ClassTupleDataSourceDrivenTests__TestSou [global::System.Runtime.CompilerServices.UnsafeAccessor(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Field, Name = "k__BackingField")] private static extern ref global::System.ValueTuple GetProperty4BackingField(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests instance); #endif - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassTupleDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassTupleDataSourceDrivenTests", 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[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[2]) - }, - Properties = new global::TUnit.Core.PropertyMetadata[] - { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests); - var metadata_DataSource_TupleMethod__int_string_bool = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_TupleMethod", "DataSource_TupleMethod", 27, - __InvokeTest_DataSource_TupleMethod__int_string_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_TupleMethod", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, - new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, + 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[] + { + global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[0]), + global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[1]), + global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[2]) + }, + Properties = new global::TUnit.Core.PropertyMetadata[] + { + 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! + } }, - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_TupleMethod", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[1]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + 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])) { - new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, - new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, - }, - propertyDataSources: new global::TUnit.Core.PropertyDataSource[] + 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 __Invoke(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - new global::TUnit.Core.PropertyDataSource + case 0: { - PropertyName = "Property1", - PropertyType = typeof(global::System.ValueTuple), - DataSource = new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") + try { - Factory = (dataGeneratorMetadata) => + switch (args.Length) { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); + 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}"); } - }, - }, - new global::TUnit.Core.PropertyDataSource - { - PropertyName = "Property2", - PropertyType = typeof(global::System.ValueTuple), - DataSource = new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, - }, - new global::TUnit.Core.PropertyDataSource - { - PropertyName = "Property3", - PropertyType = typeof(global::System.ValueTuple), - DataSource = new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, - }, - new global::TUnit.Core.PropertyDataSource - { - PropertyName = "Property4", - PropertyType = typeof(global::System.ValueTuple), - DataSource = new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, - }, - }, - propertyInjections: new global::TUnit.Core.PropertyInjectionData[] - { - new global::TUnit.Core.PropertyInjectionData - { - PropertyName = "Property1", - PropertyType = typeof(global::System.ValueTuple), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetProperty1BackingField((global::TUnit.TestProject.ClassTupleDataSourceDrivenTests)instance) = (global::System.ValueTuple)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => - { - return new global::System.Collections.Generic.Dictionary(); } - }, - new global::TUnit.Core.PropertyInjectionData - { - PropertyName = "Property2", - PropertyType = typeof(global::System.ValueTuple), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetProperty2BackingField((global::TUnit.TestProject.ClassTupleDataSourceDrivenTests)instance) = (global::System.ValueTuple)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => + catch (global::System.Exception ex) { - return new global::System.Collections.Generic.Dictionary(); + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } - }, - new global::TUnit.Core.PropertyInjectionData - { - PropertyName = "Property3", - PropertyType = typeof(global::System.ValueTuple), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetProperty3BackingField((global::TUnit.TestProject.ClassTupleDataSourceDrivenTests)instance) = (global::System.ValueTuple)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => - { - return new global::System.Collections.Generic.Dictionary(); - } - }, - new global::TUnit.Core.PropertyInjectionData + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) + { + case 0: { - PropertyName = "Property4", - PropertyType = typeof(global::System.ValueTuple), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetProperty4BackingField((global::TUnit.TestProject.ClassTupleDataSourceDrivenTests)instance) = (global::System.ValueTuple)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => - { - return new global::System.Collections.Generic.Dictionary(); - } - }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_DataSource_TupleMethod__int_string_bool }; + 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") + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.ClassTupleDataSourceDrivenTests.DataSource_TupleMethod", - ClassName = "ClassTupleDataSourceDrivenTests", MethodName = "DataSource_TupleMethod", FullyQualifiedName = "TUnit.TestProject.ClassTupleDataSourceDrivenTests.DataSource_TupleMethod", FilePath = @"", @@ -302,321 +155,70 @@ internal static class TUnit_TestProject_ClassTupleDataSourceDrivenTests__TestSou HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_TupleMethod__int_string_bool - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - 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::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_TupleMethod__int_string_bool(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") { - try + Factory = (dataGeneratorMetadata) => { - switch (args.Length) + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - 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}"); + var result = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } + return Factory(); } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_TupleMethod__int_string_bool(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassTupleDataSourceDrivenTests", 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[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[2]) - }, - Properties = new global::TUnit.Core.PropertyMetadata[] - { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_TupleMethod", "DataSource_TupleMethod", 27, - __InvokeTest_DataSource_TupleMethod__int_string_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_TupleMethod", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, - new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, }, - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] + new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") { - new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, - new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") + Factory = (dataGeneratorMetadata) => { - Factory = (dataGeneratorMetadata) => + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); + var result = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } - }, + return Factory(); + } }, - propertyDataSources: new global::TUnit.Core.PropertyDataSource[] +}, + ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") { - new global::TUnit.Core.PropertyDataSource - { - PropertyName = "Property1", - PropertyType = typeof(global::System.ValueTuple), - DataSource = new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, - }, - new global::TUnit.Core.PropertyDataSource - { - PropertyName = "Property2", - PropertyType = typeof(global::System.ValueTuple), - DataSource = new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, - }, - new global::TUnit.Core.PropertyDataSource - { - PropertyName = "Property3", - PropertyType = typeof(global::System.ValueTuple), - DataSource = new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, - }, - new global::TUnit.Core.PropertyDataSource + Factory = (dataGeneratorMetadata) => { - PropertyName = "Property4", - PropertyType = typeof(global::System.ValueTuple), - DataSource = new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, - }, + var result = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.TupleMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } + return Factory(); + } }, - propertyInjections: new global::TUnit.Core.PropertyInjectionData[] + new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") { - new global::TUnit.Core.PropertyInjectionData + Factory = (dataGeneratorMetadata) => { - PropertyName = "Property1", - PropertyType = typeof(global::System.ValueTuple), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetProperty1BackingField((global::TUnit.TestProject.ClassTupleDataSourceDrivenTests)instance) = (global::System.ValueTuple)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - return new global::System.Collections.Generic.Dictionary(); + var result = global::TUnit.TestProject.ClassTupleDataSourceDrivenTests.NamedTupleMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } - }, - new global::TUnit.Core.PropertyInjectionData - { - PropertyName = "Property2", - PropertyType = typeof(global::System.ValueTuple), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetProperty2BackingField((global::TUnit.TestProject.ClassTupleDataSourceDrivenTests)instance) = (global::System.ValueTuple)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => - { - return new global::System.Collections.Generic.Dictionary(); - } - }, - new global::TUnit.Core.PropertyInjectionData - { - PropertyName = "Property3", - PropertyType = typeof(global::System.ValueTuple), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetProperty3BackingField((global::TUnit.TestProject.ClassTupleDataSourceDrivenTests)instance) = (global::System.ValueTuple)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => - { - return new global::System.Collections.Generic.Dictionary(); - } - }, - new global::TUnit.Core.PropertyInjectionData - { - PropertyName = "Property4", - PropertyType = typeof(global::System.ValueTuple), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetProperty4BackingField((global::TUnit.TestProject.ClassTupleDataSourceDrivenTests)instance) = (global::System.ValueTuple)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => - { - return new global::System.Collections.Generic.Dictionary(); - } - }, + return Factory(); + } }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal 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), - }; - } +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_ClassTupleDataSourceDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests), TUnit_TestProject_ClassTupleDataSourceDrivenTests__TestSource.GetTests, TUnit_TestProject_ClassTupleDataSourceDrivenTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_ClassTupleDataSourceDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_ClassTupleDataSourceDrivenTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/ConcreteClassTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConcreteClassTests.Test.verified.txt index 9d37c10762..b258156575 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConcreteClassTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConcreteClassTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,34 +7,64 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_AbstractTests_ConcreteClass2__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AbstractTests.ConcreteClass2", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("SecondTest", __classType, typeof(void), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.AbstractTests.ConcreteClass2 instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AbstractTests.ConcreteClass2", new global::TUnit.Core.ClassMetadata + switch (methodIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2); - var metadata_SecondTest = global::TUnit.Core.TestMetadataFactory.Create( - "SecondTest", "SecondTest", 11, - __InvokeTest_SecondTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SecondTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_SecondTest }; + case 0: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Attribute[] __Attributes(int groupIndex) { - yield return new global::TUnit.Core.TestDescriptor + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.InheritsTestsAttribute(), + new global::TUnit.Core.InheritsTestsAttribute() + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } + } + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.AbstractTests.ConcreteClass2.SecondTest", - ClassName = "ConcreteClass2", MethodName = "SecondTest", FullyQualifiedName = "TUnit.TestProject.AbstractTests.ConcreteClass2.SecondTest", FilePath = @"", @@ -44,60 +74,18 @@ internal static class TUnit_TestProject_AbstractTests_ConcreteClass2__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_SecondTest - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.InheritsTestsAttribute(), - new global::TUnit.Core.InheritsTestsAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_SecondTest(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_SecondTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AbstractTests.ConcreteClass2", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "SecondTest", "SecondTest", 11, - __InvokeTest_SecondTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SecondTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.AbstractTests.ConcreteClass2 CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.AbstractTests.ConcreteClass2(); - } + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_AbstractTests_ConcreteClass2__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), TUnit_TestProject_AbstractTests_ConcreteClass2__TestSource.GetTests, TUnit_TestProject_AbstractTests_ConcreteClass2__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_AbstractTests_ConcreteClass2__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_AbstractTests_ConcreteClass2__TestSource.Entries); } @@ -110,57 +98,49 @@ internal static partial class TUnit_TestRegistration namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_AssertClassName_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal static class TUnit_TestProject_AbstractTests_ConcreteClass2_AssertClassName_TestSource { - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AbstractTests.ConcreteClass2", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("AssertClassName", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static global::TUnit.TestProject.AbstractTests.ConcreteClass2 __CreateInstance_0(global::System.Type[] typeArgs, object?[] args) { - var metadata = new global::TUnit.Core.TestMetadata + return new global::TUnit.TestProject.AbstractTests.ConcreteClass2(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.AbstractTests.ConcreteClass2 instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try { - TestName = "AssertClassName", - TestClassType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), - TestMethodName = "AssertClassName", - Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - InheritanceDepth = 2, - FilePath = @"", - LineNumber = 3, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - Type = typeof(global::TUnit.TestProject.AbstractTests.AbstractBaseClass), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AbstractTests.AbstractBaseClass)), - Name = "AssertClassName", - GenericTypeCount = 0, - 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", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = __CreateInstance, - InvokeTypedTest = __InvokeTest, + 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)); + } + } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.InheritsTestsAttribute(), + new global::TUnit.Core.InheritsTestsAttribute() }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.AbstractTests.ConcreteClass2.AssertClassName", - ClassName = "ConcreteClass2", MethodName = "AssertClassName", FullyQualifiedName = "TUnit.TestProject.AbstractTests.ConcreteClass2.AssertClassName", FilePath = @"", @@ -170,37 +150,18 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_AssertClass HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - 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)); - } - } + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_AbstractTests_ConcreteClass2_AssertClassName_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), new TUnit_TestProject_AbstractTests_ConcreteClass2_AssertClassName_TestSource()); + static readonly int _r_TUnit_TestProject_AbstractTests_ConcreteClass2_AssertClassName_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_AbstractTests_ConcreteClass2_AssertClassName_TestSource.Entries_0); } @@ -213,57 +174,48 @@ internal static partial class TUnit_TestRegistration namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClassName_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal static class TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClassName_TestSource { - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AbstractTests.ConcreteClass1", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("AssertClassName", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static global::TUnit.TestProject.AbstractTests.ConcreteClass1 __CreateInstance_0(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.AbstractTests.ConcreteClass1(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.AbstractTests.ConcreteClass1 instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) { - var metadata = new global::TUnit.Core.TestMetadata + try { - TestName = "AssertClassName", - TestClassType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1), - TestMethodName = "AssertClassName", - Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - InheritanceDepth = 1, - FilePath = @"", - LineNumber = 3, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - Type = typeof(global::TUnit.TestProject.AbstractTests.AbstractBaseClass), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AbstractTests.AbstractBaseClass)), - Name = "AssertClassName", - GenericTypeCount = 0, - 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", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = __CreateInstance, - InvokeTypedTest = __InvokeTest, + 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)); + } + } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.InheritsTestsAttribute() }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.AbstractTests.ConcreteClass1.AssertClassName", - ClassName = "ConcreteClass1", MethodName = "AssertClassName", FullyQualifiedName = "TUnit.TestProject.AbstractTests.ConcreteClass1.AssertClassName", FilePath = @"", @@ -273,34 +225,16 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClass HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - 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)); - } - } + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClassName_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1), new TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClassName_TestSource()); + static readonly int _r_TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClassName_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClassName_TestSource.Entries_0); } 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 541c2796f2..0aa3823183 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 @@ -7,46 +7,86 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_BasicTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.BasicTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.BasicTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata_SynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "SynchronousTest", "SynchronousTest", 5, - __InvokeTest_SynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - var metadata_AsynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "AsynchronousTest", "AsynchronousTest", 11, - __InvokeTest_AsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - var metadata_ValueTaskAsynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "ValueTaskAsynchronousTest", "ValueTaskAsynchronousTest", 17, - __InvokeTest_ValueTaskAsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_SynchronousTest, metadata_AsynchronousTest, metadata_ValueTaskAsynchronousTest }; + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: + { + try + { + return instance.ValueTaskAsynchronousTest(); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Attribute[] __Attributes(int groupIndex) { - yield return new global::TUnit.Core.TestDescriptor + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } + } + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.SynchronousTest", - ClassName = "BasicTests", MethodName = "SynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.SynchronousTest", FilePath = @"", @@ -56,12 +96,15 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_SynchronousTest - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", - ClassName = "BasicTests", MethodName = "AsynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", FilePath = @"", @@ -71,12 +114,15 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_AsynchronousTest - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - ClassName = "BasicTests", MethodName = "ValueTaskAsynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", FilePath = @"", @@ -86,122 +132,16 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_ValueTaskAsynchronousTest - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_SynchronousTest(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_AsynchronousTest(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_ValueTaskAsynchronousTest(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_SynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "SynchronousTest", "SynchronousTest", 5, - __InvokeTest_SynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "AsynchronousTest", "AsynchronousTest", 11, - __InvokeTest_AsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_ValueTaskAsynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "ValueTaskAsynchronousTest", "ValueTaskAsynchronousTest", 17, - __InvokeTest_ValueTaskAsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.BasicTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_BasicTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.BasicTests), TUnit_TestProject_BasicTests__TestSource.GetTests, TUnit_TestProject_BasicTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_BasicTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_BasicTests__TestSource.Entries); } 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 541c2796f2..0aa3823183 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 @@ -7,46 +7,86 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_BasicTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.BasicTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.BasicTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata_SynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "SynchronousTest", "SynchronousTest", 5, - __InvokeTest_SynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - var metadata_AsynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "AsynchronousTest", "AsynchronousTest", 11, - __InvokeTest_AsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - var metadata_ValueTaskAsynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "ValueTaskAsynchronousTest", "ValueTaskAsynchronousTest", 17, - __InvokeTest_ValueTaskAsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_SynchronousTest, metadata_AsynchronousTest, metadata_ValueTaskAsynchronousTest }; + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: + { + try + { + return instance.ValueTaskAsynchronousTest(); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Attribute[] __Attributes(int groupIndex) { - yield return new global::TUnit.Core.TestDescriptor + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } + } + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.SynchronousTest", - ClassName = "BasicTests", MethodName = "SynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.SynchronousTest", FilePath = @"", @@ -56,12 +96,15 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_SynchronousTest - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", - ClassName = "BasicTests", MethodName = "AsynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", FilePath = @"", @@ -71,12 +114,15 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_AsynchronousTest - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - ClassName = "BasicTests", MethodName = "ValueTaskAsynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", FilePath = @"", @@ -86,122 +132,16 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_ValueTaskAsynchronousTest - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_SynchronousTest(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_AsynchronousTest(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_ValueTaskAsynchronousTest(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_SynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "SynchronousTest", "SynchronousTest", 5, - __InvokeTest_SynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "AsynchronousTest", "AsynchronousTest", 11, - __InvokeTest_AsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_ValueTaskAsynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "ValueTaskAsynchronousTest", "ValueTaskAsynchronousTest", 17, - __InvokeTest_ValueTaskAsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.BasicTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_BasicTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.BasicTests), TUnit_TestProject_BasicTests__TestSource.GetTests, TUnit_TestProject_BasicTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_BasicTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_BasicTests__TestSource.Entries); } 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 541c2796f2..0aa3823183 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 @@ -7,46 +7,86 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_BasicTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.BasicTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.BasicTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata_SynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "SynchronousTest", "SynchronousTest", 5, - __InvokeTest_SynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - var metadata_AsynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "AsynchronousTest", "AsynchronousTest", 11, - __InvokeTest_AsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - var metadata_ValueTaskAsynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "ValueTaskAsynchronousTest", "ValueTaskAsynchronousTest", 17, - __InvokeTest_ValueTaskAsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_SynchronousTest, metadata_AsynchronousTest, metadata_ValueTaskAsynchronousTest }; + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: + { + try + { + return instance.ValueTaskAsynchronousTest(); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Attribute[] __Attributes(int groupIndex) { - yield return new global::TUnit.Core.TestDescriptor + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } + } + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.SynchronousTest", - ClassName = "BasicTests", MethodName = "SynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.SynchronousTest", FilePath = @"", @@ -56,12 +96,15 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_SynchronousTest - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", - ClassName = "BasicTests", MethodName = "AsynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", FilePath = @"", @@ -71,12 +114,15 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_AsynchronousTest - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - ClassName = "BasicTests", MethodName = "ValueTaskAsynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", FilePath = @"", @@ -86,122 +132,16 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_ValueTaskAsynchronousTest - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_SynchronousTest(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_AsynchronousTest(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_ValueTaskAsynchronousTest(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_SynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "SynchronousTest", "SynchronousTest", 5, - __InvokeTest_SynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "AsynchronousTest", "AsynchronousTest", 11, - __InvokeTest_AsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_ValueTaskAsynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "ValueTaskAsynchronousTest", "ValueTaskAsynchronousTest", 17, - __InvokeTest_ValueTaskAsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.BasicTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_BasicTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.BasicTests), TUnit_TestProject_BasicTests__TestSource.GetTests, TUnit_TestProject_BasicTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_BasicTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_BasicTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.BasicTest_WithConflictingNamespace.Net4_7.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.BasicTest_WithConflictingNamespace.Net4_7.verified.txt index a791373b8c..d67d8a3266 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.BasicTest_WithConflictingNamespace.Net4_7.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.BasicTest_WithConflictingNamespace.Net4_7.verified.txt @@ -7,46 +7,86 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_BasicTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.BasicTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.BasicTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata_SynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "SynchronousTest", "SynchronousTest", 5, - __InvokeTest_SynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - var metadata_AsynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "AsynchronousTest", "AsynchronousTest", 11, - __InvokeTest_AsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - var metadata_ValueTaskAsynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "ValueTaskAsynchronousTest", "ValueTaskAsynchronousTest", 17, - __InvokeTest_ValueTaskAsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_SynchronousTest, metadata_AsynchronousTest, metadata_ValueTaskAsynchronousTest }; + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: + { + try + { + return instance.ValueTaskAsynchronousTest(); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Attribute[] __Attributes(int groupIndex) { - yield return new global::TUnit.Core.TestDescriptor + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } + } + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.SynchronousTest", - ClassName = "BasicTests", MethodName = "SynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.SynchronousTest", FilePath = @"", @@ -56,12 +96,15 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_SynchronousTest - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", - ClassName = "BasicTests", MethodName = "AsynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", FilePath = @"", @@ -71,12 +114,15 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_AsynchronousTest - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - ClassName = "BasicTests", MethodName = "ValueTaskAsynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", FilePath = @"", @@ -86,122 +132,16 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_ValueTaskAsynchronousTest - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_SynchronousTest(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_AsynchronousTest(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_ValueTaskAsynchronousTest(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_SynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "SynchronousTest", "SynchronousTest", 5, - __InvokeTest_SynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "AsynchronousTest", "AsynchronousTest", 11, - __InvokeTest_AsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_ValueTaskAsynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "ValueTaskAsynchronousTest", "ValueTaskAsynchronousTest", 17, - __InvokeTest_ValueTaskAsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.BasicTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_BasicTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.BasicTests), TUnit_TestProject_BasicTests__TestSource.GetTests, TUnit_TestProject_BasicTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_BasicTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_BasicTests__TestSource.Entries); } 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 7e2f85dd6a..3fb5a9164d 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 @@ -7,167 +7,291 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_DataDrivenTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.DataDrivenTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("EnumValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.TestEnum), "testEnum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TestEnum)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_3 = global::TUnit.Core.MethodMetadataFactory.Create("NullValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_4 = global::TUnit.Core.MethodMetadataFactory.Create("EmptyString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_5 = global::TUnit.Core.MethodMetadataFactory.Create("NonEmptyString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_6 = global::TUnit.Core.MethodMetadataFactory.Create("BooleanString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool?), "value", new global::TUnit.Core.ConcreteType(typeof(bool?)), true, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_7 = global::TUnit.Core.MethodMetadataFactory.Create("Type", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Type), "value", new global::TUnit.Core.ConcreteType(typeof(global::System.Type)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_8 = global::TUnit.Core.MethodMetadataFactory.Create("IntegerArray", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int[]), "values", new global::TUnit.Core.ConcreteType(typeof(int[])), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_9 = global::TUnit.Core.MethodMetadataFactory.Create("IntMaxValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata_DataSource_Method__int = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method", "DataSource_Method", 8, - __InvokeTest_DataSource_Method__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1), - new global::TUnit.Core.ArgumentsAttribute(2), - new global::TUnit.Core.ArgumentsAttribute(3), - }, - testSessionId: testSessionId - ); - var metadata_DataSource_Method__int_string = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method", "DataSource_Method", 17, - __InvokeTest_DataSource_Method__int_string, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1, "String"), - new global::TUnit.Core.ArgumentsAttribute(2, "String2"), - new global::TUnit.Core.ArgumentsAttribute(3, "String3"), - }, - testSessionId: testSessionId - ); - var metadata_EnumValue__TestEnum = global::TUnit.Core.TestMetadataFactory.Create( - "EnumValue", "EnumValue", 26, - __InvokeTest_EnumValue__TestEnum, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("EnumValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.TestEnum), "testEnum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TestEnum)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.One), - new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.Two), - new global::TUnit.Core.ArgumentsAttribute(-1), - }, - testSessionId: testSessionId - ); - var metadata_NullValue__string_ = global::TUnit.Core.TestMetadataFactory.Create( - "NullValue", "NullValue", 35, - __InvokeTest_NullValue__string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("NullValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(null), - }, - testSessionId: testSessionId - ); - var metadata_EmptyString__string_ = global::TUnit.Core.TestMetadataFactory.Create( - "EmptyString", "EmptyString", 42, - __InvokeTest_EmptyString__string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("EmptyString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(""), - }, - testSessionId: testSessionId - ); - var metadata_NonEmptyString__string_ = global::TUnit.Core.TestMetadataFactory.Create( - "NonEmptyString", "NonEmptyString", 49, - __InvokeTest_NonEmptyString__string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("NonEmptyString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("Foo bar!"), - }, - testSessionId: testSessionId - ); - var metadata_BooleanString__bool_ = global::TUnit.Core.TestMetadataFactory.Create( - "BooleanString", "BooleanString", 56, - __InvokeTest_BooleanString__bool_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("BooleanString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool?), "value", new global::TUnit.Core.ConcreteType(typeof(bool?)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(null), - new global::TUnit.Core.ArgumentsAttribute(false), - new global::TUnit.Core.ArgumentsAttribute(true), - }, - testSessionId: testSessionId - ); - var metadata_Type__Type = global::TUnit.Core.TestMetadataFactory.Create( - "Type", "Type", 65, - __InvokeTest_Type__Type, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Type", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Type), "value", new global::TUnit.Core.ConcreteType(typeof(global::System.Type)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(typeof(object)), - }, - testSessionId: testSessionId - ); - var metadata_IntegerArray__int__ = global::TUnit.Core.TestMetadataFactory.Create( - "IntegerArray", "IntegerArray", 72, - __InvokeTest_IntegerArray__int__, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("IntegerArray", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int[]), "values", new global::TUnit.Core.ConcreteType(typeof(int[])), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(new[] { 1, 2, 3 }), - }, - testSessionId: testSessionId - ); - var metadata_IntMaxValue__int = global::TUnit.Core.TestMetadataFactory.Create( - "IntMaxValue", "IntMaxValue", 79, - __InvokeTest_IntMaxValue__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("IntMaxValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke(global::TUnit.TestProject.DataDrivenTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: + { + 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)); + } + } + case 3: + { + 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)); + } + } + case 4: + { + 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)); + } + } + case 5: + { + 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)); + } + } + case 6: + { + 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)); + } + } + case 7: + { + 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)); + } + } + case 8: + { + 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)); + } + } + case 9: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - new global::TUnit.Core.ArgumentsAttribute(2147483647), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_DataSource_Method__int, metadata_DataSource_Method__int_string, metadata_EnumValue__TestEnum, metadata_NullValue__string_, metadata_EmptyString__string_, metadata_NonEmptyString__string_, metadata_BooleanString__bool_, metadata_Type__Type, metadata_IntegerArray__int__, metadata_IntMaxValue__int }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.DataSource_Method", - ClassName = "DataDrivenTests", MethodName = "DataSource_Method", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method", FilePath = @"", @@ -177,12 +301,21 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_Method__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(1), + new global::TUnit.Core.ArgumentsAttribute(2), + new global::TUnit.Core.ArgumentsAttribute(3), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.DataSource_Method", - ClassName = "DataDrivenTests", MethodName = "DataSource_Method", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method", FilePath = @"", @@ -192,12 +325,21 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_Method__int_string - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(1, "String"), + new global::TUnit.Core.ArgumentsAttribute(2, "String2"), + new global::TUnit.Core.ArgumentsAttribute(3, "String3"), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.EnumValue", - ClassName = "DataDrivenTests", MethodName = "EnumValue", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EnumValue", FilePath = @"", @@ -207,12 +349,21 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_EnumValue__TestEnum - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.One), + new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.Two), + new global::TUnit.Core.ArgumentsAttribute(-1), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.NullValue", - ClassName = "DataDrivenTests", MethodName = "NullValue", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NullValue", FilePath = @"", @@ -222,12 +373,19 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_NullValue__string_ - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_3, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 3, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(null), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.EmptyString", - ClassName = "DataDrivenTests", MethodName = "EmptyString", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EmptyString", FilePath = @"", @@ -237,12 +395,19 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_EmptyString__string_ - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_4, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 4, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(""), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.NonEmptyString", - ClassName = "DataDrivenTests", MethodName = "NonEmptyString", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NonEmptyString", FilePath = @"", @@ -252,12 +417,19 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_NonEmptyString__string_ - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_5, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 5, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute("Foo bar!"), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.BooleanString", - ClassName = "DataDrivenTests", MethodName = "BooleanString", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.BooleanString", FilePath = @"", @@ -267,12 +439,21 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_BooleanString__bool_ - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_6, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 6, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(null), + new global::TUnit.Core.ArgumentsAttribute(false), + new global::TUnit.Core.ArgumentsAttribute(true), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.Type", - ClassName = "DataDrivenTests", MethodName = "Type", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.Type", FilePath = @"", @@ -282,12 +463,19 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Type__Type - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_7, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 7, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(typeof(object)), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.IntegerArray", - ClassName = "DataDrivenTests", MethodName = "IntegerArray", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntegerArray", FilePath = @"", @@ -297,12 +485,19 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_IntegerArray__int__ - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_8, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 8, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(new[] { 1, 2, 3 }), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.IntMaxValue", - ClassName = "DataDrivenTests", MethodName = "IntMaxValue", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntMaxValue", FilePath = @"", @@ -312,522 +507,20 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_IntMaxValue__int - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method__int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method__int_string(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_EnumValue__TestEnum(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_NullValue__string_(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_EmptyString__string_(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_NonEmptyString__string_(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_BooleanString__bool_(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Type__Type(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_IntegerArray__int__(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_IntMaxValue__int(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method", "DataSource_Method", 8, - __InvokeTest_DataSource_Method__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1), - new global::TUnit.Core.ArgumentsAttribute(2), - new global::TUnit.Core.ArgumentsAttribute(3), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method__int_string(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method", "DataSource_Method", 17, - __InvokeTest_DataSource_Method__int_string, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1, "String"), - new global::TUnit.Core.ArgumentsAttribute(2, "String2"), - new global::TUnit.Core.ArgumentsAttribute(3, "String3"), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_EnumValue__TestEnum(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "EnumValue", "EnumValue", 26, - __InvokeTest_EnumValue__TestEnum, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("EnumValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.TestEnum), "testEnum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TestEnum)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.One), - new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.Two), - new global::TUnit.Core.ArgumentsAttribute(-1), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_NullValue__string_(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "NullValue", "NullValue", 35, - __InvokeTest_NullValue__string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("NullValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(null), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_EmptyString__string_(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "EmptyString", "EmptyString", 42, - __InvokeTest_EmptyString__string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("EmptyString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(""), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_NonEmptyString__string_(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "NonEmptyString", "NonEmptyString", 49, - __InvokeTest_NonEmptyString__string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("NonEmptyString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("Foo bar!"), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_BooleanString__bool_(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "BooleanString", "BooleanString", 56, - __InvokeTest_BooleanString__bool_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("BooleanString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool?), "value", new global::TUnit.Core.ConcreteType(typeof(bool?)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(null), - new global::TUnit.Core.ArgumentsAttribute(false), - new global::TUnit.Core.ArgumentsAttribute(true), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Type__Type(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Type", "Type", 65, - __InvokeTest_Type__Type, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Type", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Type), "value", new global::TUnit.Core.ConcreteType(typeof(global::System.Type)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(typeof(object)), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_IntegerArray__int__(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "IntegerArray", "IntegerArray", 72, - __InvokeTest_IntegerArray__int__, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("IntegerArray", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int[]), "values", new global::TUnit.Core.ConcreteType(typeof(int[])), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(new[] { 1, 2, 3 }), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_IntMaxValue__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "IntMaxValue", "IntMaxValue", 79, - __InvokeTest_IntMaxValue__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("IntMaxValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(2147483647), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.DataDrivenTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } + MethodMetadata = __mm_9, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 9, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(2147483647), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_DataDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.DataDrivenTests), TUnit_TestProject_DataDrivenTests__TestSource.GetTests, TUnit_TestProject_DataDrivenTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_DataDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_DataDrivenTests__TestSource.Entries); } 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 7e2f85dd6a..3fb5a9164d 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 @@ -7,167 +7,291 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_DataDrivenTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.DataDrivenTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("EnumValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.TestEnum), "testEnum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TestEnum)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_3 = global::TUnit.Core.MethodMetadataFactory.Create("NullValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_4 = global::TUnit.Core.MethodMetadataFactory.Create("EmptyString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_5 = global::TUnit.Core.MethodMetadataFactory.Create("NonEmptyString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_6 = global::TUnit.Core.MethodMetadataFactory.Create("BooleanString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool?), "value", new global::TUnit.Core.ConcreteType(typeof(bool?)), true, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_7 = global::TUnit.Core.MethodMetadataFactory.Create("Type", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Type), "value", new global::TUnit.Core.ConcreteType(typeof(global::System.Type)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_8 = global::TUnit.Core.MethodMetadataFactory.Create("IntegerArray", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int[]), "values", new global::TUnit.Core.ConcreteType(typeof(int[])), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_9 = global::TUnit.Core.MethodMetadataFactory.Create("IntMaxValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata_DataSource_Method__int = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method", "DataSource_Method", 8, - __InvokeTest_DataSource_Method__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1), - new global::TUnit.Core.ArgumentsAttribute(2), - new global::TUnit.Core.ArgumentsAttribute(3), - }, - testSessionId: testSessionId - ); - var metadata_DataSource_Method__int_string = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method", "DataSource_Method", 17, - __InvokeTest_DataSource_Method__int_string, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1, "String"), - new global::TUnit.Core.ArgumentsAttribute(2, "String2"), - new global::TUnit.Core.ArgumentsAttribute(3, "String3"), - }, - testSessionId: testSessionId - ); - var metadata_EnumValue__TestEnum = global::TUnit.Core.TestMetadataFactory.Create( - "EnumValue", "EnumValue", 26, - __InvokeTest_EnumValue__TestEnum, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("EnumValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.TestEnum), "testEnum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TestEnum)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.One), - new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.Two), - new global::TUnit.Core.ArgumentsAttribute(-1), - }, - testSessionId: testSessionId - ); - var metadata_NullValue__string_ = global::TUnit.Core.TestMetadataFactory.Create( - "NullValue", "NullValue", 35, - __InvokeTest_NullValue__string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("NullValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(null), - }, - testSessionId: testSessionId - ); - var metadata_EmptyString__string_ = global::TUnit.Core.TestMetadataFactory.Create( - "EmptyString", "EmptyString", 42, - __InvokeTest_EmptyString__string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("EmptyString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(""), - }, - testSessionId: testSessionId - ); - var metadata_NonEmptyString__string_ = global::TUnit.Core.TestMetadataFactory.Create( - "NonEmptyString", "NonEmptyString", 49, - __InvokeTest_NonEmptyString__string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("NonEmptyString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("Foo bar!"), - }, - testSessionId: testSessionId - ); - var metadata_BooleanString__bool_ = global::TUnit.Core.TestMetadataFactory.Create( - "BooleanString", "BooleanString", 56, - __InvokeTest_BooleanString__bool_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("BooleanString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool?), "value", new global::TUnit.Core.ConcreteType(typeof(bool?)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(null), - new global::TUnit.Core.ArgumentsAttribute(false), - new global::TUnit.Core.ArgumentsAttribute(true), - }, - testSessionId: testSessionId - ); - var metadata_Type__Type = global::TUnit.Core.TestMetadataFactory.Create( - "Type", "Type", 65, - __InvokeTest_Type__Type, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Type", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Type), "value", new global::TUnit.Core.ConcreteType(typeof(global::System.Type)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(typeof(object)), - }, - testSessionId: testSessionId - ); - var metadata_IntegerArray__int__ = global::TUnit.Core.TestMetadataFactory.Create( - "IntegerArray", "IntegerArray", 72, - __InvokeTest_IntegerArray__int__, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("IntegerArray", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int[]), "values", new global::TUnit.Core.ConcreteType(typeof(int[])), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(new[] { 1, 2, 3 }), - }, - testSessionId: testSessionId - ); - var metadata_IntMaxValue__int = global::TUnit.Core.TestMetadataFactory.Create( - "IntMaxValue", "IntMaxValue", 79, - __InvokeTest_IntMaxValue__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("IntMaxValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke(global::TUnit.TestProject.DataDrivenTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: + { + 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)); + } + } + case 3: + { + 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)); + } + } + case 4: + { + 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)); + } + } + case 5: + { + 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)); + } + } + case 6: + { + 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)); + } + } + case 7: + { + 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)); + } + } + case 8: + { + 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)); + } + } + case 9: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - new global::TUnit.Core.ArgumentsAttribute(2147483647), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_DataSource_Method__int, metadata_DataSource_Method__int_string, metadata_EnumValue__TestEnum, metadata_NullValue__string_, metadata_EmptyString__string_, metadata_NonEmptyString__string_, metadata_BooleanString__bool_, metadata_Type__Type, metadata_IntegerArray__int__, metadata_IntMaxValue__int }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.DataSource_Method", - ClassName = "DataDrivenTests", MethodName = "DataSource_Method", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method", FilePath = @"", @@ -177,12 +301,21 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_Method__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(1), + new global::TUnit.Core.ArgumentsAttribute(2), + new global::TUnit.Core.ArgumentsAttribute(3), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.DataSource_Method", - ClassName = "DataDrivenTests", MethodName = "DataSource_Method", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method", FilePath = @"", @@ -192,12 +325,21 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_Method__int_string - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(1, "String"), + new global::TUnit.Core.ArgumentsAttribute(2, "String2"), + new global::TUnit.Core.ArgumentsAttribute(3, "String3"), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.EnumValue", - ClassName = "DataDrivenTests", MethodName = "EnumValue", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EnumValue", FilePath = @"", @@ -207,12 +349,21 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_EnumValue__TestEnum - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.One), + new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.Two), + new global::TUnit.Core.ArgumentsAttribute(-1), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.NullValue", - ClassName = "DataDrivenTests", MethodName = "NullValue", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NullValue", FilePath = @"", @@ -222,12 +373,19 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_NullValue__string_ - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_3, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 3, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(null), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.EmptyString", - ClassName = "DataDrivenTests", MethodName = "EmptyString", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EmptyString", FilePath = @"", @@ -237,12 +395,19 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_EmptyString__string_ - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_4, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 4, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(""), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.NonEmptyString", - ClassName = "DataDrivenTests", MethodName = "NonEmptyString", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NonEmptyString", FilePath = @"", @@ -252,12 +417,19 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_NonEmptyString__string_ - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_5, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 5, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute("Foo bar!"), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.BooleanString", - ClassName = "DataDrivenTests", MethodName = "BooleanString", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.BooleanString", FilePath = @"", @@ -267,12 +439,21 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_BooleanString__bool_ - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_6, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 6, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(null), + new global::TUnit.Core.ArgumentsAttribute(false), + new global::TUnit.Core.ArgumentsAttribute(true), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.Type", - ClassName = "DataDrivenTests", MethodName = "Type", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.Type", FilePath = @"", @@ -282,12 +463,19 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Type__Type - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_7, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 7, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(typeof(object)), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.IntegerArray", - ClassName = "DataDrivenTests", MethodName = "IntegerArray", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntegerArray", FilePath = @"", @@ -297,12 +485,19 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_IntegerArray__int__ - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_8, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 8, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(new[] { 1, 2, 3 }), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.IntMaxValue", - ClassName = "DataDrivenTests", MethodName = "IntMaxValue", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntMaxValue", FilePath = @"", @@ -312,522 +507,20 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_IntMaxValue__int - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method__int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method__int_string(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_EnumValue__TestEnum(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_NullValue__string_(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_EmptyString__string_(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_NonEmptyString__string_(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_BooleanString__bool_(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Type__Type(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_IntegerArray__int__(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_IntMaxValue__int(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method", "DataSource_Method", 8, - __InvokeTest_DataSource_Method__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1), - new global::TUnit.Core.ArgumentsAttribute(2), - new global::TUnit.Core.ArgumentsAttribute(3), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method__int_string(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method", "DataSource_Method", 17, - __InvokeTest_DataSource_Method__int_string, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1, "String"), - new global::TUnit.Core.ArgumentsAttribute(2, "String2"), - new global::TUnit.Core.ArgumentsAttribute(3, "String3"), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_EnumValue__TestEnum(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "EnumValue", "EnumValue", 26, - __InvokeTest_EnumValue__TestEnum, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("EnumValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.TestEnum), "testEnum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TestEnum)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.One), - new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.Two), - new global::TUnit.Core.ArgumentsAttribute(-1), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_NullValue__string_(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "NullValue", "NullValue", 35, - __InvokeTest_NullValue__string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("NullValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(null), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_EmptyString__string_(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "EmptyString", "EmptyString", 42, - __InvokeTest_EmptyString__string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("EmptyString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(""), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_NonEmptyString__string_(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "NonEmptyString", "NonEmptyString", 49, - __InvokeTest_NonEmptyString__string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("NonEmptyString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("Foo bar!"), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_BooleanString__bool_(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "BooleanString", "BooleanString", 56, - __InvokeTest_BooleanString__bool_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("BooleanString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool?), "value", new global::TUnit.Core.ConcreteType(typeof(bool?)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(null), - new global::TUnit.Core.ArgumentsAttribute(false), - new global::TUnit.Core.ArgumentsAttribute(true), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Type__Type(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Type", "Type", 65, - __InvokeTest_Type__Type, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Type", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Type), "value", new global::TUnit.Core.ConcreteType(typeof(global::System.Type)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(typeof(object)), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_IntegerArray__int__(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "IntegerArray", "IntegerArray", 72, - __InvokeTest_IntegerArray__int__, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("IntegerArray", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int[]), "values", new global::TUnit.Core.ConcreteType(typeof(int[])), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(new[] { 1, 2, 3 }), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_IntMaxValue__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "IntMaxValue", "IntMaxValue", 79, - __InvokeTest_IntMaxValue__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("IntMaxValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(2147483647), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.DataDrivenTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } + MethodMetadata = __mm_9, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 9, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(2147483647), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_DataDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.DataDrivenTests), TUnit_TestProject_DataDrivenTests__TestSource.GetTests, TUnit_TestProject_DataDrivenTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_DataDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_DataDrivenTests__TestSource.Entries); } 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 7e2f85dd6a..3fb5a9164d 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 @@ -7,167 +7,291 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_DataDrivenTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.DataDrivenTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("EnumValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.TestEnum), "testEnum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TestEnum)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_3 = global::TUnit.Core.MethodMetadataFactory.Create("NullValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_4 = global::TUnit.Core.MethodMetadataFactory.Create("EmptyString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_5 = global::TUnit.Core.MethodMetadataFactory.Create("NonEmptyString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_6 = global::TUnit.Core.MethodMetadataFactory.Create("BooleanString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool?), "value", new global::TUnit.Core.ConcreteType(typeof(bool?)), true, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_7 = global::TUnit.Core.MethodMetadataFactory.Create("Type", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Type), "value", new global::TUnit.Core.ConcreteType(typeof(global::System.Type)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_8 = global::TUnit.Core.MethodMetadataFactory.Create("IntegerArray", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int[]), "values", new global::TUnit.Core.ConcreteType(typeof(int[])), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_9 = global::TUnit.Core.MethodMetadataFactory.Create("IntMaxValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata_DataSource_Method__int = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method", "DataSource_Method", 8, - __InvokeTest_DataSource_Method__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1), - new global::TUnit.Core.ArgumentsAttribute(2), - new global::TUnit.Core.ArgumentsAttribute(3), - }, - testSessionId: testSessionId - ); - var metadata_DataSource_Method__int_string = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method", "DataSource_Method", 17, - __InvokeTest_DataSource_Method__int_string, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1, "String"), - new global::TUnit.Core.ArgumentsAttribute(2, "String2"), - new global::TUnit.Core.ArgumentsAttribute(3, "String3"), - }, - testSessionId: testSessionId - ); - var metadata_EnumValue__TestEnum = global::TUnit.Core.TestMetadataFactory.Create( - "EnumValue", "EnumValue", 26, - __InvokeTest_EnumValue__TestEnum, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("EnumValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.TestEnum), "testEnum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TestEnum)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.One), - new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.Two), - new global::TUnit.Core.ArgumentsAttribute(-1), - }, - testSessionId: testSessionId - ); - var metadata_NullValue__string_ = global::TUnit.Core.TestMetadataFactory.Create( - "NullValue", "NullValue", 35, - __InvokeTest_NullValue__string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("NullValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(null), - }, - testSessionId: testSessionId - ); - var metadata_EmptyString__string_ = global::TUnit.Core.TestMetadataFactory.Create( - "EmptyString", "EmptyString", 42, - __InvokeTest_EmptyString__string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("EmptyString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(""), - }, - testSessionId: testSessionId - ); - var metadata_NonEmptyString__string_ = global::TUnit.Core.TestMetadataFactory.Create( - "NonEmptyString", "NonEmptyString", 49, - __InvokeTest_NonEmptyString__string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("NonEmptyString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("Foo bar!"), - }, - testSessionId: testSessionId - ); - var metadata_BooleanString__bool_ = global::TUnit.Core.TestMetadataFactory.Create( - "BooleanString", "BooleanString", 56, - __InvokeTest_BooleanString__bool_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("BooleanString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool?), "value", new global::TUnit.Core.ConcreteType(typeof(bool?)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(null), - new global::TUnit.Core.ArgumentsAttribute(false), - new global::TUnit.Core.ArgumentsAttribute(true), - }, - testSessionId: testSessionId - ); - var metadata_Type__Type = global::TUnit.Core.TestMetadataFactory.Create( - "Type", "Type", 65, - __InvokeTest_Type__Type, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Type", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Type), "value", new global::TUnit.Core.ConcreteType(typeof(global::System.Type)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(typeof(object)), - }, - testSessionId: testSessionId - ); - var metadata_IntegerArray__int__ = global::TUnit.Core.TestMetadataFactory.Create( - "IntegerArray", "IntegerArray", 72, - __InvokeTest_IntegerArray__int__, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("IntegerArray", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int[]), "values", new global::TUnit.Core.ConcreteType(typeof(int[])), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(new[] { 1, 2, 3 }), - }, - testSessionId: testSessionId - ); - var metadata_IntMaxValue__int = global::TUnit.Core.TestMetadataFactory.Create( - "IntMaxValue", "IntMaxValue", 79, - __InvokeTest_IntMaxValue__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("IntMaxValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke(global::TUnit.TestProject.DataDrivenTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: + { + 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)); + } + } + case 3: + { + 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)); + } + } + case 4: + { + 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)); + } + } + case 5: + { + 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)); + } + } + case 6: + { + 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)); + } + } + case 7: + { + 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)); + } + } + case 8: + { + 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)); + } + } + case 9: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - new global::TUnit.Core.ArgumentsAttribute(2147483647), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_DataSource_Method__int, metadata_DataSource_Method__int_string, metadata_EnumValue__TestEnum, metadata_NullValue__string_, metadata_EmptyString__string_, metadata_NonEmptyString__string_, metadata_BooleanString__bool_, metadata_Type__Type, metadata_IntegerArray__int__, metadata_IntMaxValue__int }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.DataSource_Method", - ClassName = "DataDrivenTests", MethodName = "DataSource_Method", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method", FilePath = @"", @@ -177,12 +301,21 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_Method__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(1), + new global::TUnit.Core.ArgumentsAttribute(2), + new global::TUnit.Core.ArgumentsAttribute(3), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.DataSource_Method", - ClassName = "DataDrivenTests", MethodName = "DataSource_Method", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method", FilePath = @"", @@ -192,12 +325,21 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_Method__int_string - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(1, "String"), + new global::TUnit.Core.ArgumentsAttribute(2, "String2"), + new global::TUnit.Core.ArgumentsAttribute(3, "String3"), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.EnumValue", - ClassName = "DataDrivenTests", MethodName = "EnumValue", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EnumValue", FilePath = @"", @@ -207,12 +349,21 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_EnumValue__TestEnum - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.One), + new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.Two), + new global::TUnit.Core.ArgumentsAttribute(-1), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.NullValue", - ClassName = "DataDrivenTests", MethodName = "NullValue", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NullValue", FilePath = @"", @@ -222,12 +373,19 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_NullValue__string_ - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_3, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 3, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(null), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.EmptyString", - ClassName = "DataDrivenTests", MethodName = "EmptyString", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EmptyString", FilePath = @"", @@ -237,12 +395,19 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_EmptyString__string_ - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_4, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 4, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(""), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.NonEmptyString", - ClassName = "DataDrivenTests", MethodName = "NonEmptyString", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NonEmptyString", FilePath = @"", @@ -252,12 +417,19 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_NonEmptyString__string_ - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_5, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 5, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute("Foo bar!"), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.BooleanString", - ClassName = "DataDrivenTests", MethodName = "BooleanString", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.BooleanString", FilePath = @"", @@ -267,12 +439,21 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_BooleanString__bool_ - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_6, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 6, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(null), + new global::TUnit.Core.ArgumentsAttribute(false), + new global::TUnit.Core.ArgumentsAttribute(true), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.Type", - ClassName = "DataDrivenTests", MethodName = "Type", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.Type", FilePath = @"", @@ -282,12 +463,19 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Type__Type - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_7, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 7, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(typeof(object)), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.IntegerArray", - ClassName = "DataDrivenTests", MethodName = "IntegerArray", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntegerArray", FilePath = @"", @@ -297,12 +485,19 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_IntegerArray__int__ - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_8, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 8, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(new[] { 1, 2, 3 }), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.IntMaxValue", - ClassName = "DataDrivenTests", MethodName = "IntMaxValue", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntMaxValue", FilePath = @"", @@ -312,522 +507,20 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_IntMaxValue__int - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method__int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method__int_string(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_EnumValue__TestEnum(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_NullValue__string_(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_EmptyString__string_(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_NonEmptyString__string_(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_BooleanString__bool_(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Type__Type(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_IntegerArray__int__(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_IntMaxValue__int(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method", "DataSource_Method", 8, - __InvokeTest_DataSource_Method__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1), - new global::TUnit.Core.ArgumentsAttribute(2), - new global::TUnit.Core.ArgumentsAttribute(3), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method__int_string(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method", "DataSource_Method", 17, - __InvokeTest_DataSource_Method__int_string, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1, "String"), - new global::TUnit.Core.ArgumentsAttribute(2, "String2"), - new global::TUnit.Core.ArgumentsAttribute(3, "String3"), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_EnumValue__TestEnum(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "EnumValue", "EnumValue", 26, - __InvokeTest_EnumValue__TestEnum, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("EnumValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.TestEnum), "testEnum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TestEnum)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.One), - new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.Two), - new global::TUnit.Core.ArgumentsAttribute(-1), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_NullValue__string_(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "NullValue", "NullValue", 35, - __InvokeTest_NullValue__string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("NullValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(null), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_EmptyString__string_(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "EmptyString", "EmptyString", 42, - __InvokeTest_EmptyString__string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("EmptyString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(""), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_NonEmptyString__string_(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "NonEmptyString", "NonEmptyString", 49, - __InvokeTest_NonEmptyString__string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("NonEmptyString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("Foo bar!"), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_BooleanString__bool_(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "BooleanString", "BooleanString", 56, - __InvokeTest_BooleanString__bool_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("BooleanString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool?), "value", new global::TUnit.Core.ConcreteType(typeof(bool?)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(null), - new global::TUnit.Core.ArgumentsAttribute(false), - new global::TUnit.Core.ArgumentsAttribute(true), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Type__Type(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Type", "Type", 65, - __InvokeTest_Type__Type, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Type", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Type), "value", new global::TUnit.Core.ConcreteType(typeof(global::System.Type)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(typeof(object)), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_IntegerArray__int__(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "IntegerArray", "IntegerArray", 72, - __InvokeTest_IntegerArray__int__, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("IntegerArray", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int[]), "values", new global::TUnit.Core.ConcreteType(typeof(int[])), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(new[] { 1, 2, 3 }), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_IntMaxValue__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "IntMaxValue", "IntMaxValue", 79, - __InvokeTest_IntMaxValue__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("IntMaxValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(2147483647), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.DataDrivenTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } + MethodMetadata = __mm_9, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 9, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(2147483647), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_DataDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.DataDrivenTests), TUnit_TestProject_DataDrivenTests__TestSource.GetTests, TUnit_TestProject_DataDrivenTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_DataDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_DataDrivenTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.DataDrivenTest_WithConflictingNamespace.Net4_7.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.DataDrivenTest_WithConflictingNamespace.Net4_7.verified.txt index 7aa0e643fa..445031327d 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.DataDrivenTest_WithConflictingNamespace.Net4_7.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.DataDrivenTest_WithConflictingNamespace.Net4_7.verified.txt @@ -7,167 +7,291 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_DataDrivenTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.DataDrivenTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("EnumValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.TestEnum), "testEnum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TestEnum)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_3 = global::TUnit.Core.MethodMetadataFactory.Create("NullValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_4 = global::TUnit.Core.MethodMetadataFactory.Create("EmptyString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_5 = global::TUnit.Core.MethodMetadataFactory.Create("NonEmptyString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_6 = global::TUnit.Core.MethodMetadataFactory.Create("BooleanString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool?), "value", new global::TUnit.Core.ConcreteType(typeof(bool?)), true, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_7 = global::TUnit.Core.MethodMetadataFactory.Create("Type", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Type), "value", new global::TUnit.Core.ConcreteType(typeof(global::System.Type)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_8 = global::TUnit.Core.MethodMetadataFactory.Create("IntegerArray", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int[]), "values", new global::TUnit.Core.ConcreteType(typeof(int[])), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_9 = global::TUnit.Core.MethodMetadataFactory.Create("IntMaxValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata_DataSource_Method__int = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method", "DataSource_Method", 8, - __InvokeTest_DataSource_Method__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1), - new global::TUnit.Core.ArgumentsAttribute(2), - new global::TUnit.Core.ArgumentsAttribute(3), - }, - testSessionId: testSessionId - ); - var metadata_DataSource_Method__int_string = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method", "DataSource_Method", 17, - __InvokeTest_DataSource_Method__int_string, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1, "String"), - new global::TUnit.Core.ArgumentsAttribute(2, "String2"), - new global::TUnit.Core.ArgumentsAttribute(3, "String3"), - }, - testSessionId: testSessionId - ); - var metadata_EnumValue__TestEnum = global::TUnit.Core.TestMetadataFactory.Create( - "EnumValue", "EnumValue", 26, - __InvokeTest_EnumValue__TestEnum, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("EnumValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.TestEnum), "testEnum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TestEnum)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.One), - new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.Two), - new global::TUnit.Core.ArgumentsAttribute(-1), - }, - testSessionId: testSessionId - ); - var metadata_NullValue__string_ = global::TUnit.Core.TestMetadataFactory.Create( - "NullValue", "NullValue", 35, - __InvokeTest_NullValue__string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("NullValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(null), - }, - testSessionId: testSessionId - ); - var metadata_EmptyString__string_ = global::TUnit.Core.TestMetadataFactory.Create( - "EmptyString", "EmptyString", 42, - __InvokeTest_EmptyString__string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("EmptyString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(""), - }, - testSessionId: testSessionId - ); - var metadata_NonEmptyString__string_ = global::TUnit.Core.TestMetadataFactory.Create( - "NonEmptyString", "NonEmptyString", 49, - __InvokeTest_NonEmptyString__string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("NonEmptyString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("Foo bar!"), - }, - testSessionId: testSessionId - ); - var metadata_BooleanString__bool_ = global::TUnit.Core.TestMetadataFactory.Create( - "BooleanString", "BooleanString", 56, - __InvokeTest_BooleanString__bool_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("BooleanString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool?), "value", new global::TUnit.Core.ConcreteType(typeof(bool?)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(null), - new global::TUnit.Core.ArgumentsAttribute(false), - new global::TUnit.Core.ArgumentsAttribute(true), - }, - testSessionId: testSessionId - ); - var metadata_Type__Type = global::TUnit.Core.TestMetadataFactory.Create( - "Type", "Type", 65, - __InvokeTest_Type__Type, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Type", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Type), "value", new global::TUnit.Core.ConcreteType(typeof(global::System.Type)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(typeof(object)), - }, - testSessionId: testSessionId - ); - var metadata_IntegerArray__int__ = global::TUnit.Core.TestMetadataFactory.Create( - "IntegerArray", "IntegerArray", 72, - __InvokeTest_IntegerArray__int__, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("IntegerArray", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int[]), "values", new global::TUnit.Core.ConcreteType(typeof(int[])), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(new[] { 1, 2, 3 }), - }, - testSessionId: testSessionId - ); - var metadata_IntMaxValue__int = global::TUnit.Core.TestMetadataFactory.Create( - "IntMaxValue", "IntMaxValue", 79, - __InvokeTest_IntMaxValue__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("IntMaxValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke(global::TUnit.TestProject.DataDrivenTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: + { + 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)); + } + } + case 3: + { + 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)); + } + } + case 4: + { + 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)); + } + } + case 5: + { + 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)); + } + } + case 6: + { + 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)); + } + } + case 7: + { + 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)); + } + } + case 8: + { + 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)); + } + } + case 9: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - new global::TUnit.Core.ArgumentsAttribute(2147483647), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_DataSource_Method__int, metadata_DataSource_Method__int_string, metadata_EnumValue__TestEnum, metadata_NullValue__string_, metadata_EmptyString__string_, metadata_NonEmptyString__string_, metadata_BooleanString__bool_, metadata_Type__Type, metadata_IntegerArray__int__, metadata_IntMaxValue__int }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.DataSource_Method", - ClassName = "DataDrivenTests", MethodName = "DataSource_Method", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method", FilePath = @"", @@ -177,12 +301,21 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_Method__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(1), + new global::TUnit.Core.ArgumentsAttribute(2), + new global::TUnit.Core.ArgumentsAttribute(3), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.DataSource_Method", - ClassName = "DataDrivenTests", MethodName = "DataSource_Method", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method", FilePath = @"", @@ -192,12 +325,21 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_Method__int_string - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(1, "String"), + new global::TUnit.Core.ArgumentsAttribute(2, "String2"), + new global::TUnit.Core.ArgumentsAttribute(3, "String3"), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.EnumValue", - ClassName = "DataDrivenTests", MethodName = "EnumValue", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EnumValue", FilePath = @"", @@ -207,12 +349,21 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_EnumValue__TestEnum - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.One), + new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.Two), + new global::TUnit.Core.ArgumentsAttribute(-1), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.NullValue", - ClassName = "DataDrivenTests", MethodName = "NullValue", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NullValue", FilePath = @"", @@ -222,12 +373,19 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_NullValue__string_ - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_3, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 3, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(null), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.EmptyString", - ClassName = "DataDrivenTests", MethodName = "EmptyString", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EmptyString", FilePath = @"", @@ -237,12 +395,19 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_EmptyString__string_ - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_4, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 4, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(""), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.NonEmptyString", - ClassName = "DataDrivenTests", MethodName = "NonEmptyString", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NonEmptyString", FilePath = @"", @@ -252,12 +417,19 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_NonEmptyString__string_ - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_5, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 5, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute("Foo bar!"), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.BooleanString", - ClassName = "DataDrivenTests", MethodName = "BooleanString", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.BooleanString", FilePath = @"", @@ -267,12 +439,21 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_BooleanString__bool_ - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_6, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 6, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(null), + new global::TUnit.Core.ArgumentsAttribute(false), + new global::TUnit.Core.ArgumentsAttribute(true), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.Type", - ClassName = "DataDrivenTests", MethodName = "Type", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.Type", FilePath = @"", @@ -282,12 +463,19 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Type__Type - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_7, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 7, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(typeof(object)), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.IntegerArray", - ClassName = "DataDrivenTests", MethodName = "IntegerArray", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntegerArray", FilePath = @"", @@ -297,12 +485,19 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_IntegerArray__int__ - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_8, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 8, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(new[] { 1, 2, 3 }), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.IntMaxValue", - ClassName = "DataDrivenTests", MethodName = "IntMaxValue", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntMaxValue", FilePath = @"", @@ -312,522 +507,20 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_IntMaxValue__int - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method__int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method__int_string(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_EnumValue__TestEnum(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_NullValue__string_(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_EmptyString__string_(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_NonEmptyString__string_(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_BooleanString__bool_(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Type__Type(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_IntegerArray__int__(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_IntMaxValue__int(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method", "DataSource_Method", 8, - __InvokeTest_DataSource_Method__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1), - new global::TUnit.Core.ArgumentsAttribute(2), - new global::TUnit.Core.ArgumentsAttribute(3), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method__int_string(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method", "DataSource_Method", 17, - __InvokeTest_DataSource_Method__int_string, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1, "String"), - new global::TUnit.Core.ArgumentsAttribute(2, "String2"), - new global::TUnit.Core.ArgumentsAttribute(3, "String3"), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_EnumValue__TestEnum(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "EnumValue", "EnumValue", 26, - __InvokeTest_EnumValue__TestEnum, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("EnumValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.TestEnum), "testEnum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TestEnum)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.One), - new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.Two), - new global::TUnit.Core.ArgumentsAttribute(-1), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_NullValue__string_(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "NullValue", "NullValue", 35, - __InvokeTest_NullValue__string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("NullValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(null), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_EmptyString__string_(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "EmptyString", "EmptyString", 42, - __InvokeTest_EmptyString__string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("EmptyString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(""), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_NonEmptyString__string_(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "NonEmptyString", "NonEmptyString", 49, - __InvokeTest_NonEmptyString__string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("NonEmptyString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("Foo bar!"), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_BooleanString__bool_(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "BooleanString", "BooleanString", 56, - __InvokeTest_BooleanString__bool_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("BooleanString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool?), "value", new global::TUnit.Core.ConcreteType(typeof(bool?)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(null), - new global::TUnit.Core.ArgumentsAttribute(false), - new global::TUnit.Core.ArgumentsAttribute(true), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Type__Type(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Type", "Type", 65, - __InvokeTest_Type__Type, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Type", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Type), "value", new global::TUnit.Core.ConcreteType(typeof(global::System.Type)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(typeof(object)), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_IntegerArray__int__(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "IntegerArray", "IntegerArray", 72, - __InvokeTest_IntegerArray__int__, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("IntegerArray", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int[]), "values", new global::TUnit.Core.ConcreteType(typeof(int[])), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(new[] { 1, 2, 3 }), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_IntMaxValue__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "IntMaxValue", "IntMaxValue", 79, - __InvokeTest_IntMaxValue__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("IntMaxValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(2147483647), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.DataDrivenTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } + MethodMetadata = __mm_9, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 9, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(2147483647), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_DataDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.DataDrivenTests), TUnit_TestProject_DataDrivenTests__TestSource.GetTests, TUnit_TestProject_DataDrivenTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_DataDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_DataDrivenTests__TestSource.Entries); } 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 1de4364acd..3fadc7eef9 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 @@ -7,210 +7,373 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_MatrixTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.MatrixTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_One", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[1]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_Two", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i2", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[1]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i3", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[2]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_Enum", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(TestEnum), "testEnum", new global::TUnit.Core.ConcreteType(typeof(TestEnum)), false, reflectionInfoFactory: static () => 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()[1]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(TestEnum?), "testEnum2", new global::TUnit.Core.ConcreteType(typeof(TestEnum?)), true, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_3 = global::TUnit.Core.MethodMetadataFactory.Create("AutoGenerateBools", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_4 = global::TUnit.Core.MethodMetadataFactory.Create("AutoGenerateBools2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool?), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool?)), true, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_5 = global::TUnit.Core.MethodMetadataFactory.Create("ImplicitConversion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(OneOf), "enum", new global::TUnit.Core.ConcreteType(typeof(OneOf)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_6 = global::TUnit.Core.MethodMetadataFactory.Create("ExcludingAutoGeneratedMatrixValues", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), "enum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_7 = global::TUnit.Core.MethodMetadataFactory.Create("Method1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_8 = global::TUnit.Core.MethodMetadataFactory.Create("Method2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_9 = global::TUnit.Core.MethodMetadataFactory.Create("Method3", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_10 = global::TUnit.Core.MethodMetadataFactory.Create("Method4", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_11 = global::TUnit.Core.MethodMetadataFactory.Create("Exclusion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item2", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_12 = global::TUnit.Core.MethodMetadataFactory.Create("MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "flag", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), "enum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)), false, reflectionInfoFactory: static () => 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]) +}); + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata_MatrixTest_One__string_int_bool = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixTest_One", "MatrixTest_One", 9, - __InvokeTest_MatrixTest_One__string_int_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_One", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_MatrixTest_Two__int_int_int_bool = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixTest_Two", "MatrixTest_Two", 19, - __InvokeTest_MatrixTest_Two__int_int_int_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_Two", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i2", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i3", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[2]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_MatrixTest_Enum__int_TestEnum_TestEnum_ = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixTest_Enum", "MatrixTest_Enum", 30, - __InvokeTest_MatrixTest_Enum__int_TestEnum_TestEnum_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_Enum", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(TestEnum), "testEnum", new global::TUnit.Core.ConcreteType(typeof(TestEnum)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(TestEnum?), "testEnum2", new global::TUnit.Core.ConcreteType(typeof(TestEnum?)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_AutoGenerateBools__string_bool = global::TUnit.Core.TestMetadataFactory.Create( - "AutoGenerateBools", "AutoGenerateBools", 40, - __InvokeTest_AutoGenerateBools__string_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AutoGenerateBools", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_AutoGenerateBools2__string_bool_ = global::TUnit.Core.TestMetadataFactory.Create( - "AutoGenerateBools2", "AutoGenerateBools2", 49, - __InvokeTest_AutoGenerateBools2__string_bool_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AutoGenerateBools2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool?), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool?)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool = global::TUnit.Core.TestMetadataFactory.Create( - "ImplicitConversion", "ImplicitConversion", 58, - __InvokeTest_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ImplicitConversion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(OneOf), "enum", new global::TUnit.Core.ConcreteType(typeof(OneOf)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool = global::TUnit.Core.TestMetadataFactory.Create( - "ExcludingAutoGeneratedMatrixValues", "ExcludingAutoGeneratedMatrixValues", 67, - __InvokeTest_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ExcludingAutoGeneratedMatrixValues", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), "enum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_Method1__int = global::TUnit.Core.TestMetadataFactory.Create( - "Method1", "Method1", 116, - __InvokeTest_Method1__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Method1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_Method2__int = global::TUnit.Core.TestMetadataFactory.Create( - "Method2", "Method2", 124, - __InvokeTest_Method2__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Method2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_Method3__int = global::TUnit.Core.TestMetadataFactory.Create( - "Method3", "Method3", 132, - __InvokeTest_Method3__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Method3", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_Method4__int = global::TUnit.Core.TestMetadataFactory.Create( - "Method4", "Method4", 140, - __InvokeTest_Method4__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Method4", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_Exclusion__int_int = global::TUnit.Core.TestMetadataFactory.Create( - "Exclusion", "Exclusion", 148, - __InvokeTest_Exclusion__int_int, __CreateAttributes_1, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Exclusion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item2", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", 197, - __InvokeTest_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke(global::TUnit.TestProject.MatrixTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "flag", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), "enum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: + { + 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)); + } + } + case 3: + { + 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)); + } + } + case 4: + { + 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)); + } + } + case 5: + { + 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)); + } + } + case 6: + { + 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)); + } + } + case 7: + { + 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)); + } + } + case 8: + { + 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)); + } + } + case 9: + { + 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)); + } + } + case 10: + { + 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)); + } + } + case 11: + { + 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)); + } + } + case 12: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_MatrixTest_One__string_int_bool, metadata_MatrixTest_Two__int_int_int_bool, metadata_MatrixTest_Enum__int_TestEnum_TestEnum_, metadata_AutoGenerateBools__string_bool, metadata_AutoGenerateBools2__string_bool_, metadata_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool, metadata_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool, metadata_Method1__int, metadata_Method2__int, metadata_Method3__int, metadata_Method4__int, metadata_Exclusion__int_int, metadata_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + case 1: + { + 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) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.MatrixTest_One", - ClassName = "MatrixTests", MethodName = "MatrixTest_One", FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_One", FilePath = @"", @@ -220,12 +383,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_MatrixTest_One__string_int_bool - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.MatrixTest_Two", - ClassName = "MatrixTests", MethodName = "MatrixTest_Two", FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_Two", FilePath = @"", @@ -235,12 +405,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_MatrixTest_Two__int_int_int_bool - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.MatrixTest_Enum", - ClassName = "MatrixTests", MethodName = "MatrixTest_Enum", FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_Enum", FilePath = @"", @@ -250,12 +427,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_MatrixTest_Enum__int_TestEnum_TestEnum_ - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.AutoGenerateBools", - ClassName = "MatrixTests", MethodName = "AutoGenerateBools", FullyQualifiedName = "TUnit.TestProject.MatrixTests.AutoGenerateBools", FilePath = @"", @@ -265,12 +449,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_AutoGenerateBools__string_bool - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_3, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 3, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.AutoGenerateBools2", - ClassName = "MatrixTests", MethodName = "AutoGenerateBools2", FullyQualifiedName = "TUnit.TestProject.MatrixTests.AutoGenerateBools2", FilePath = @"", @@ -280,12 +471,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_AutoGenerateBools2__string_bool_ - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_4, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 4, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.ImplicitConversion", - ClassName = "MatrixTests", MethodName = "ImplicitConversion", FullyQualifiedName = "TUnit.TestProject.MatrixTests.ImplicitConversion", FilePath = @"", @@ -295,12 +493,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_5, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 5, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.ExcludingAutoGeneratedMatrixValues", - ClassName = "MatrixTests", MethodName = "ExcludingAutoGeneratedMatrixValues", FullyQualifiedName = "TUnit.TestProject.MatrixTests.ExcludingAutoGeneratedMatrixValues", FilePath = @"", @@ -310,12 +515,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_6, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 6, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.Method1", - ClassName = "MatrixTests", MethodName = "Method1", FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method1", FilePath = @"", @@ -325,12 +537,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Method1__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_7, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 7, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.Method2", - ClassName = "MatrixTests", MethodName = "Method2", FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method2", FilePath = @"", @@ -340,12 +559,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Method2__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_8, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 8, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.Method3", - ClassName = "MatrixTests", MethodName = "Method3", FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method3", FilePath = @"", @@ -355,12 +581,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Method3__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_9, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 9, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.Method4", - ClassName = "MatrixTests", MethodName = "Method4", FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method4", FilePath = @"", @@ -370,12 +603,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Method4__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_10, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 10, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.Exclusion", - ClassName = "MatrixTests", MethodName = "Exclusion", FullyQualifiedName = "TUnit.TestProject.MatrixTests.Exclusion", FilePath = @"", @@ -385,12 +625,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Exclusion__int_int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_11, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 11, + CreateAttributes = __Attributes, + AttributeGroupIndex = 1, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", - ClassName = "MatrixTests", MethodName = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", FilePath = @"", @@ -400,671 +647,20 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Attribute[] __CreateAttributes_1() - { - 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::System.Threading.Tasks.ValueTask __InvokeTest_MatrixTest_One__string_int_bool(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_MatrixTest_Two__int_int_int_bool(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_MatrixTest_Enum__int_TestEnum_TestEnum_(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_AutoGenerateBools__string_bool(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_AutoGenerateBools2__string_bool_(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Method1__int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Method2__int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Method3__int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Method4__int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Exclusion__int_int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_MatrixTest_One__string_int_bool(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixTest_One", "MatrixTest_One", 9, - __InvokeTest_MatrixTest_One__string_int_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_One", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_MatrixTest_Two__int_int_int_bool(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixTest_Two", "MatrixTest_Two", 19, - __InvokeTest_MatrixTest_Two__int_int_int_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_Two", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i2", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i3", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[2]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_MatrixTest_Enum__int_TestEnum_TestEnum_(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixTest_Enum", "MatrixTest_Enum", 30, - __InvokeTest_MatrixTest_Enum__int_TestEnum_TestEnum_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_Enum", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(TestEnum), "testEnum", new global::TUnit.Core.ConcreteType(typeof(TestEnum)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(TestEnum?), "testEnum2", new global::TUnit.Core.ConcreteType(typeof(TestEnum?)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_AutoGenerateBools__string_bool(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "AutoGenerateBools", "AutoGenerateBools", 40, - __InvokeTest_AutoGenerateBools__string_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AutoGenerateBools", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_AutoGenerateBools2__string_bool_(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "AutoGenerateBools2", "AutoGenerateBools2", 49, - __InvokeTest_AutoGenerateBools2__string_bool_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AutoGenerateBools2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool?), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool?)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "ImplicitConversion", "ImplicitConversion", 58, - __InvokeTest_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ImplicitConversion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(OneOf), "enum", new global::TUnit.Core.ConcreteType(typeof(OneOf)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "ExcludingAutoGeneratedMatrixValues", "ExcludingAutoGeneratedMatrixValues", 67, - __InvokeTest_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ExcludingAutoGeneratedMatrixValues", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), "enum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Method1__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Method1", "Method1", 116, - __InvokeTest_Method1__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Method1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Method2__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Method2", "Method2", 124, - __InvokeTest_Method2__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Method2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Method3__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Method3", "Method3", 132, - __InvokeTest_Method3__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Method3", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Method4__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Method4", "Method4", 140, - __InvokeTest_Method4__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Method4", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Exclusion__int_int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Exclusion", "Exclusion", 148, - __InvokeTest_Exclusion__int_int, __CreateAttributes_1, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Exclusion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item2", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", 197, - __InvokeTest_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "flag", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), "enum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.MatrixTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } + MethodMetadata = __mm_12, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 12, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_MatrixTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.MatrixTests), TUnit_TestProject_MatrixTests__TestSource.GetTests, TUnit_TestProject_MatrixTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_MatrixTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_MatrixTests__TestSource.Entries); } 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 1de4364acd..3fadc7eef9 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 @@ -7,210 +7,373 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_MatrixTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.MatrixTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_One", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[1]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_Two", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i2", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[1]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i3", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[2]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_Enum", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(TestEnum), "testEnum", new global::TUnit.Core.ConcreteType(typeof(TestEnum)), false, reflectionInfoFactory: static () => 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()[1]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(TestEnum?), "testEnum2", new global::TUnit.Core.ConcreteType(typeof(TestEnum?)), true, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_3 = global::TUnit.Core.MethodMetadataFactory.Create("AutoGenerateBools", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_4 = global::TUnit.Core.MethodMetadataFactory.Create("AutoGenerateBools2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool?), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool?)), true, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_5 = global::TUnit.Core.MethodMetadataFactory.Create("ImplicitConversion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(OneOf), "enum", new global::TUnit.Core.ConcreteType(typeof(OneOf)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_6 = global::TUnit.Core.MethodMetadataFactory.Create("ExcludingAutoGeneratedMatrixValues", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), "enum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_7 = global::TUnit.Core.MethodMetadataFactory.Create("Method1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_8 = global::TUnit.Core.MethodMetadataFactory.Create("Method2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_9 = global::TUnit.Core.MethodMetadataFactory.Create("Method3", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_10 = global::TUnit.Core.MethodMetadataFactory.Create("Method4", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_11 = global::TUnit.Core.MethodMetadataFactory.Create("Exclusion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item2", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_12 = global::TUnit.Core.MethodMetadataFactory.Create("MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "flag", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), "enum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)), false, reflectionInfoFactory: static () => 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]) +}); + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata_MatrixTest_One__string_int_bool = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixTest_One", "MatrixTest_One", 9, - __InvokeTest_MatrixTest_One__string_int_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_One", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_MatrixTest_Two__int_int_int_bool = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixTest_Two", "MatrixTest_Two", 19, - __InvokeTest_MatrixTest_Two__int_int_int_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_Two", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i2", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i3", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[2]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_MatrixTest_Enum__int_TestEnum_TestEnum_ = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixTest_Enum", "MatrixTest_Enum", 30, - __InvokeTest_MatrixTest_Enum__int_TestEnum_TestEnum_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_Enum", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(TestEnum), "testEnum", new global::TUnit.Core.ConcreteType(typeof(TestEnum)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(TestEnum?), "testEnum2", new global::TUnit.Core.ConcreteType(typeof(TestEnum?)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_AutoGenerateBools__string_bool = global::TUnit.Core.TestMetadataFactory.Create( - "AutoGenerateBools", "AutoGenerateBools", 40, - __InvokeTest_AutoGenerateBools__string_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AutoGenerateBools", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_AutoGenerateBools2__string_bool_ = global::TUnit.Core.TestMetadataFactory.Create( - "AutoGenerateBools2", "AutoGenerateBools2", 49, - __InvokeTest_AutoGenerateBools2__string_bool_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AutoGenerateBools2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool?), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool?)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool = global::TUnit.Core.TestMetadataFactory.Create( - "ImplicitConversion", "ImplicitConversion", 58, - __InvokeTest_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ImplicitConversion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(OneOf), "enum", new global::TUnit.Core.ConcreteType(typeof(OneOf)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool = global::TUnit.Core.TestMetadataFactory.Create( - "ExcludingAutoGeneratedMatrixValues", "ExcludingAutoGeneratedMatrixValues", 67, - __InvokeTest_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ExcludingAutoGeneratedMatrixValues", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), "enum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_Method1__int = global::TUnit.Core.TestMetadataFactory.Create( - "Method1", "Method1", 116, - __InvokeTest_Method1__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Method1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_Method2__int = global::TUnit.Core.TestMetadataFactory.Create( - "Method2", "Method2", 124, - __InvokeTest_Method2__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Method2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_Method3__int = global::TUnit.Core.TestMetadataFactory.Create( - "Method3", "Method3", 132, - __InvokeTest_Method3__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Method3", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_Method4__int = global::TUnit.Core.TestMetadataFactory.Create( - "Method4", "Method4", 140, - __InvokeTest_Method4__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Method4", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_Exclusion__int_int = global::TUnit.Core.TestMetadataFactory.Create( - "Exclusion", "Exclusion", 148, - __InvokeTest_Exclusion__int_int, __CreateAttributes_1, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Exclusion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item2", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", 197, - __InvokeTest_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke(global::TUnit.TestProject.MatrixTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "flag", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), "enum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: + { + 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)); + } + } + case 3: + { + 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)); + } + } + case 4: + { + 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)); + } + } + case 5: + { + 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)); + } + } + case 6: + { + 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)); + } + } + case 7: + { + 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)); + } + } + case 8: + { + 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)); + } + } + case 9: + { + 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)); + } + } + case 10: + { + 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)); + } + } + case 11: + { + 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)); + } + } + case 12: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_MatrixTest_One__string_int_bool, metadata_MatrixTest_Two__int_int_int_bool, metadata_MatrixTest_Enum__int_TestEnum_TestEnum_, metadata_AutoGenerateBools__string_bool, metadata_AutoGenerateBools2__string_bool_, metadata_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool, metadata_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool, metadata_Method1__int, metadata_Method2__int, metadata_Method3__int, metadata_Method4__int, metadata_Exclusion__int_int, metadata_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + case 1: + { + 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) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.MatrixTest_One", - ClassName = "MatrixTests", MethodName = "MatrixTest_One", FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_One", FilePath = @"", @@ -220,12 +383,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_MatrixTest_One__string_int_bool - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.MatrixTest_Two", - ClassName = "MatrixTests", MethodName = "MatrixTest_Two", FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_Two", FilePath = @"", @@ -235,12 +405,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_MatrixTest_Two__int_int_int_bool - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.MatrixTest_Enum", - ClassName = "MatrixTests", MethodName = "MatrixTest_Enum", FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_Enum", FilePath = @"", @@ -250,12 +427,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_MatrixTest_Enum__int_TestEnum_TestEnum_ - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.AutoGenerateBools", - ClassName = "MatrixTests", MethodName = "AutoGenerateBools", FullyQualifiedName = "TUnit.TestProject.MatrixTests.AutoGenerateBools", FilePath = @"", @@ -265,12 +449,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_AutoGenerateBools__string_bool - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_3, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 3, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.AutoGenerateBools2", - ClassName = "MatrixTests", MethodName = "AutoGenerateBools2", FullyQualifiedName = "TUnit.TestProject.MatrixTests.AutoGenerateBools2", FilePath = @"", @@ -280,12 +471,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_AutoGenerateBools2__string_bool_ - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_4, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 4, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.ImplicitConversion", - ClassName = "MatrixTests", MethodName = "ImplicitConversion", FullyQualifiedName = "TUnit.TestProject.MatrixTests.ImplicitConversion", FilePath = @"", @@ -295,12 +493,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_5, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 5, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.ExcludingAutoGeneratedMatrixValues", - ClassName = "MatrixTests", MethodName = "ExcludingAutoGeneratedMatrixValues", FullyQualifiedName = "TUnit.TestProject.MatrixTests.ExcludingAutoGeneratedMatrixValues", FilePath = @"", @@ -310,12 +515,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_6, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 6, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.Method1", - ClassName = "MatrixTests", MethodName = "Method1", FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method1", FilePath = @"", @@ -325,12 +537,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Method1__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_7, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 7, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.Method2", - ClassName = "MatrixTests", MethodName = "Method2", FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method2", FilePath = @"", @@ -340,12 +559,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Method2__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_8, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 8, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.Method3", - ClassName = "MatrixTests", MethodName = "Method3", FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method3", FilePath = @"", @@ -355,12 +581,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Method3__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_9, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 9, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.Method4", - ClassName = "MatrixTests", MethodName = "Method4", FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method4", FilePath = @"", @@ -370,12 +603,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Method4__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_10, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 10, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.Exclusion", - ClassName = "MatrixTests", MethodName = "Exclusion", FullyQualifiedName = "TUnit.TestProject.MatrixTests.Exclusion", FilePath = @"", @@ -385,12 +625,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Exclusion__int_int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_11, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 11, + CreateAttributes = __Attributes, + AttributeGroupIndex = 1, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", - ClassName = "MatrixTests", MethodName = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", FilePath = @"", @@ -400,671 +647,20 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Attribute[] __CreateAttributes_1() - { - 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::System.Threading.Tasks.ValueTask __InvokeTest_MatrixTest_One__string_int_bool(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_MatrixTest_Two__int_int_int_bool(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_MatrixTest_Enum__int_TestEnum_TestEnum_(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_AutoGenerateBools__string_bool(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_AutoGenerateBools2__string_bool_(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Method1__int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Method2__int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Method3__int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Method4__int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Exclusion__int_int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_MatrixTest_One__string_int_bool(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixTest_One", "MatrixTest_One", 9, - __InvokeTest_MatrixTest_One__string_int_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_One", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_MatrixTest_Two__int_int_int_bool(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixTest_Two", "MatrixTest_Two", 19, - __InvokeTest_MatrixTest_Two__int_int_int_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_Two", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i2", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i3", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[2]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_MatrixTest_Enum__int_TestEnum_TestEnum_(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixTest_Enum", "MatrixTest_Enum", 30, - __InvokeTest_MatrixTest_Enum__int_TestEnum_TestEnum_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_Enum", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(TestEnum), "testEnum", new global::TUnit.Core.ConcreteType(typeof(TestEnum)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(TestEnum?), "testEnum2", new global::TUnit.Core.ConcreteType(typeof(TestEnum?)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_AutoGenerateBools__string_bool(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "AutoGenerateBools", "AutoGenerateBools", 40, - __InvokeTest_AutoGenerateBools__string_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AutoGenerateBools", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_AutoGenerateBools2__string_bool_(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "AutoGenerateBools2", "AutoGenerateBools2", 49, - __InvokeTest_AutoGenerateBools2__string_bool_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AutoGenerateBools2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool?), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool?)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "ImplicitConversion", "ImplicitConversion", 58, - __InvokeTest_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ImplicitConversion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(OneOf), "enum", new global::TUnit.Core.ConcreteType(typeof(OneOf)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "ExcludingAutoGeneratedMatrixValues", "ExcludingAutoGeneratedMatrixValues", 67, - __InvokeTest_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ExcludingAutoGeneratedMatrixValues", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), "enum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Method1__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Method1", "Method1", 116, - __InvokeTest_Method1__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Method1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Method2__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Method2", "Method2", 124, - __InvokeTest_Method2__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Method2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Method3__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Method3", "Method3", 132, - __InvokeTest_Method3__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Method3", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Method4__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Method4", "Method4", 140, - __InvokeTest_Method4__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Method4", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Exclusion__int_int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Exclusion", "Exclusion", 148, - __InvokeTest_Exclusion__int_int, __CreateAttributes_1, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Exclusion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item2", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", 197, - __InvokeTest_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "flag", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), "enum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.MatrixTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } + MethodMetadata = __mm_12, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 12, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_MatrixTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.MatrixTests), TUnit_TestProject_MatrixTests__TestSource.GetTests, TUnit_TestProject_MatrixTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_MatrixTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_MatrixTests__TestSource.Entries); } 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 1de4364acd..3fadc7eef9 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 @@ -7,210 +7,373 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_MatrixTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.MatrixTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_One", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[1]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_Two", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i2", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[1]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i3", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[2]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_Enum", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(TestEnum), "testEnum", new global::TUnit.Core.ConcreteType(typeof(TestEnum)), false, reflectionInfoFactory: static () => 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()[1]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(TestEnum?), "testEnum2", new global::TUnit.Core.ConcreteType(typeof(TestEnum?)), true, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_3 = global::TUnit.Core.MethodMetadataFactory.Create("AutoGenerateBools", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_4 = global::TUnit.Core.MethodMetadataFactory.Create("AutoGenerateBools2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool?), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool?)), true, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_5 = global::TUnit.Core.MethodMetadataFactory.Create("ImplicitConversion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(OneOf), "enum", new global::TUnit.Core.ConcreteType(typeof(OneOf)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_6 = global::TUnit.Core.MethodMetadataFactory.Create("ExcludingAutoGeneratedMatrixValues", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), "enum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_7 = global::TUnit.Core.MethodMetadataFactory.Create("Method1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_8 = global::TUnit.Core.MethodMetadataFactory.Create("Method2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_9 = global::TUnit.Core.MethodMetadataFactory.Create("Method3", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_10 = global::TUnit.Core.MethodMetadataFactory.Create("Method4", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_11 = global::TUnit.Core.MethodMetadataFactory.Create("Exclusion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item2", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_12 = global::TUnit.Core.MethodMetadataFactory.Create("MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "flag", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), "enum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)), false, reflectionInfoFactory: static () => 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]) +}); + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata_MatrixTest_One__string_int_bool = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixTest_One", "MatrixTest_One", 9, - __InvokeTest_MatrixTest_One__string_int_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_One", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_MatrixTest_Two__int_int_int_bool = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixTest_Two", "MatrixTest_Two", 19, - __InvokeTest_MatrixTest_Two__int_int_int_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_Two", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i2", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i3", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[2]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_MatrixTest_Enum__int_TestEnum_TestEnum_ = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixTest_Enum", "MatrixTest_Enum", 30, - __InvokeTest_MatrixTest_Enum__int_TestEnum_TestEnum_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_Enum", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(TestEnum), "testEnum", new global::TUnit.Core.ConcreteType(typeof(TestEnum)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(TestEnum?), "testEnum2", new global::TUnit.Core.ConcreteType(typeof(TestEnum?)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_AutoGenerateBools__string_bool = global::TUnit.Core.TestMetadataFactory.Create( - "AutoGenerateBools", "AutoGenerateBools", 40, - __InvokeTest_AutoGenerateBools__string_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AutoGenerateBools", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_AutoGenerateBools2__string_bool_ = global::TUnit.Core.TestMetadataFactory.Create( - "AutoGenerateBools2", "AutoGenerateBools2", 49, - __InvokeTest_AutoGenerateBools2__string_bool_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AutoGenerateBools2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool?), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool?)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool = global::TUnit.Core.TestMetadataFactory.Create( - "ImplicitConversion", "ImplicitConversion", 58, - __InvokeTest_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ImplicitConversion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(OneOf), "enum", new global::TUnit.Core.ConcreteType(typeof(OneOf)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool = global::TUnit.Core.TestMetadataFactory.Create( - "ExcludingAutoGeneratedMatrixValues", "ExcludingAutoGeneratedMatrixValues", 67, - __InvokeTest_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ExcludingAutoGeneratedMatrixValues", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), "enum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_Method1__int = global::TUnit.Core.TestMetadataFactory.Create( - "Method1", "Method1", 116, - __InvokeTest_Method1__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Method1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_Method2__int = global::TUnit.Core.TestMetadataFactory.Create( - "Method2", "Method2", 124, - __InvokeTest_Method2__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Method2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_Method3__int = global::TUnit.Core.TestMetadataFactory.Create( - "Method3", "Method3", 132, - __InvokeTest_Method3__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Method3", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_Method4__int = global::TUnit.Core.TestMetadataFactory.Create( - "Method4", "Method4", 140, - __InvokeTest_Method4__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Method4", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_Exclusion__int_int = global::TUnit.Core.TestMetadataFactory.Create( - "Exclusion", "Exclusion", 148, - __InvokeTest_Exclusion__int_int, __CreateAttributes_1, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Exclusion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item2", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", 197, - __InvokeTest_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke(global::TUnit.TestProject.MatrixTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "flag", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), "enum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: + { + 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)); + } + } + case 3: + { + 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)); + } + } + case 4: + { + 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)); + } + } + case 5: + { + 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)); + } + } + case 6: + { + 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)); + } + } + case 7: + { + 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)); + } + } + case 8: + { + 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)); + } + } + case 9: + { + 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)); + } + } + case 10: + { + 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)); + } + } + case 11: + { + 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)); + } + } + case 12: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_MatrixTest_One__string_int_bool, metadata_MatrixTest_Two__int_int_int_bool, metadata_MatrixTest_Enum__int_TestEnum_TestEnum_, metadata_AutoGenerateBools__string_bool, metadata_AutoGenerateBools2__string_bool_, metadata_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool, metadata_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool, metadata_Method1__int, metadata_Method2__int, metadata_Method3__int, metadata_Method4__int, metadata_Exclusion__int_int, metadata_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + case 1: + { + 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) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.MatrixTest_One", - ClassName = "MatrixTests", MethodName = "MatrixTest_One", FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_One", FilePath = @"", @@ -220,12 +383,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_MatrixTest_One__string_int_bool - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.MatrixTest_Two", - ClassName = "MatrixTests", MethodName = "MatrixTest_Two", FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_Two", FilePath = @"", @@ -235,12 +405,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_MatrixTest_Two__int_int_int_bool - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.MatrixTest_Enum", - ClassName = "MatrixTests", MethodName = "MatrixTest_Enum", FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_Enum", FilePath = @"", @@ -250,12 +427,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_MatrixTest_Enum__int_TestEnum_TestEnum_ - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.AutoGenerateBools", - ClassName = "MatrixTests", MethodName = "AutoGenerateBools", FullyQualifiedName = "TUnit.TestProject.MatrixTests.AutoGenerateBools", FilePath = @"", @@ -265,12 +449,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_AutoGenerateBools__string_bool - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_3, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 3, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.AutoGenerateBools2", - ClassName = "MatrixTests", MethodName = "AutoGenerateBools2", FullyQualifiedName = "TUnit.TestProject.MatrixTests.AutoGenerateBools2", FilePath = @"", @@ -280,12 +471,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_AutoGenerateBools2__string_bool_ - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_4, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 4, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.ImplicitConversion", - ClassName = "MatrixTests", MethodName = "ImplicitConversion", FullyQualifiedName = "TUnit.TestProject.MatrixTests.ImplicitConversion", FilePath = @"", @@ -295,12 +493,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_5, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 5, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.ExcludingAutoGeneratedMatrixValues", - ClassName = "MatrixTests", MethodName = "ExcludingAutoGeneratedMatrixValues", FullyQualifiedName = "TUnit.TestProject.MatrixTests.ExcludingAutoGeneratedMatrixValues", FilePath = @"", @@ -310,12 +515,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_6, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 6, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.Method1", - ClassName = "MatrixTests", MethodName = "Method1", FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method1", FilePath = @"", @@ -325,12 +537,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Method1__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_7, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 7, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.Method2", - ClassName = "MatrixTests", MethodName = "Method2", FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method2", FilePath = @"", @@ -340,12 +559,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Method2__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_8, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 8, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.Method3", - ClassName = "MatrixTests", MethodName = "Method3", FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method3", FilePath = @"", @@ -355,12 +581,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Method3__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_9, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 9, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.Method4", - ClassName = "MatrixTests", MethodName = "Method4", FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method4", FilePath = @"", @@ -370,12 +603,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Method4__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_10, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 10, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.Exclusion", - ClassName = "MatrixTests", MethodName = "Exclusion", FullyQualifiedName = "TUnit.TestProject.MatrixTests.Exclusion", FilePath = @"", @@ -385,12 +625,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Exclusion__int_int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_11, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 11, + CreateAttributes = __Attributes, + AttributeGroupIndex = 1, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", - ClassName = "MatrixTests", MethodName = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", FilePath = @"", @@ -400,671 +647,20 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Attribute[] __CreateAttributes_1() - { - 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::System.Threading.Tasks.ValueTask __InvokeTest_MatrixTest_One__string_int_bool(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_MatrixTest_Two__int_int_int_bool(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_MatrixTest_Enum__int_TestEnum_TestEnum_(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_AutoGenerateBools__string_bool(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_AutoGenerateBools2__string_bool_(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Method1__int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Method2__int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Method3__int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Method4__int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Exclusion__int_int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_MatrixTest_One__string_int_bool(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixTest_One", "MatrixTest_One", 9, - __InvokeTest_MatrixTest_One__string_int_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_One", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_MatrixTest_Two__int_int_int_bool(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixTest_Two", "MatrixTest_Two", 19, - __InvokeTest_MatrixTest_Two__int_int_int_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_Two", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i2", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i3", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[2]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_MatrixTest_Enum__int_TestEnum_TestEnum_(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixTest_Enum", "MatrixTest_Enum", 30, - __InvokeTest_MatrixTest_Enum__int_TestEnum_TestEnum_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_Enum", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(TestEnum), "testEnum", new global::TUnit.Core.ConcreteType(typeof(TestEnum)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(TestEnum?), "testEnum2", new global::TUnit.Core.ConcreteType(typeof(TestEnum?)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_AutoGenerateBools__string_bool(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "AutoGenerateBools", "AutoGenerateBools", 40, - __InvokeTest_AutoGenerateBools__string_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AutoGenerateBools", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_AutoGenerateBools2__string_bool_(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "AutoGenerateBools2", "AutoGenerateBools2", 49, - __InvokeTest_AutoGenerateBools2__string_bool_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AutoGenerateBools2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool?), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool?)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "ImplicitConversion", "ImplicitConversion", 58, - __InvokeTest_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ImplicitConversion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(OneOf), "enum", new global::TUnit.Core.ConcreteType(typeof(OneOf)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "ExcludingAutoGeneratedMatrixValues", "ExcludingAutoGeneratedMatrixValues", 67, - __InvokeTest_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ExcludingAutoGeneratedMatrixValues", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), "enum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Method1__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Method1", "Method1", 116, - __InvokeTest_Method1__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Method1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Method2__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Method2", "Method2", 124, - __InvokeTest_Method2__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Method2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Method3__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Method3", "Method3", 132, - __InvokeTest_Method3__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Method3", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Method4__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Method4", "Method4", 140, - __InvokeTest_Method4__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Method4", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Exclusion__int_int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Exclusion", "Exclusion", 148, - __InvokeTest_Exclusion__int_int, __CreateAttributes_1, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Exclusion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item2", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", 197, - __InvokeTest_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "flag", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), "enum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.MatrixTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } + MethodMetadata = __mm_12, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 12, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_MatrixTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.MatrixTests), TUnit_TestProject_MatrixTests__TestSource.GetTests, TUnit_TestProject_MatrixTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_MatrixTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_MatrixTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MatrixTest_WithConflictingNamespace.Net4_7.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MatrixTest_WithConflictingNamespace.Net4_7.verified.txt index 096fc6dc08..31e6e3927b 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MatrixTest_WithConflictingNamespace.Net4_7.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MatrixTest_WithConflictingNamespace.Net4_7.verified.txt @@ -7,210 +7,373 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_MatrixTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.MatrixTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_One", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[1]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_Two", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i2", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[1]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i3", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[2]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_Enum", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(TestEnum), "testEnum", new global::TUnit.Core.ConcreteType(typeof(TestEnum)), false, reflectionInfoFactory: static () => 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()[1]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(TestEnum?), "testEnum2", new global::TUnit.Core.ConcreteType(typeof(TestEnum?)), true, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_3 = global::TUnit.Core.MethodMetadataFactory.Create("AutoGenerateBools", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_4 = global::TUnit.Core.MethodMetadataFactory.Create("AutoGenerateBools2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool?), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool?)), true, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_5 = global::TUnit.Core.MethodMetadataFactory.Create("ImplicitConversion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(OneOf), "enum", new global::TUnit.Core.ConcreteType(typeof(OneOf)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_6 = global::TUnit.Core.MethodMetadataFactory.Create("ExcludingAutoGeneratedMatrixValues", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), "enum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_7 = global::TUnit.Core.MethodMetadataFactory.Create("Method1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_8 = global::TUnit.Core.MethodMetadataFactory.Create("Method2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_9 = global::TUnit.Core.MethodMetadataFactory.Create("Method3", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_10 = global::TUnit.Core.MethodMetadataFactory.Create("Method4", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_11 = global::TUnit.Core.MethodMetadataFactory.Create("Exclusion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item2", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_12 = global::TUnit.Core.MethodMetadataFactory.Create("MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "flag", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), "enum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)), false, reflectionInfoFactory: static () => 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]) +}); + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata_MatrixTest_One__string_int_bool = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixTest_One", "MatrixTest_One", 9, - __InvokeTest_MatrixTest_One__string_int_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_One", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_MatrixTest_Two__int_int_int_bool = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixTest_Two", "MatrixTest_Two", 19, - __InvokeTest_MatrixTest_Two__int_int_int_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_Two", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i2", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i3", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[2]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_MatrixTest_Enum__int_TestEnum_TestEnum_ = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixTest_Enum", "MatrixTest_Enum", 30, - __InvokeTest_MatrixTest_Enum__int_TestEnum_TestEnum_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_Enum", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(TestEnum), "testEnum", new global::TUnit.Core.ConcreteType(typeof(TestEnum)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(TestEnum?), "testEnum2", new global::TUnit.Core.ConcreteType(typeof(TestEnum?)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_AutoGenerateBools__string_bool = global::TUnit.Core.TestMetadataFactory.Create( - "AutoGenerateBools", "AutoGenerateBools", 40, - __InvokeTest_AutoGenerateBools__string_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AutoGenerateBools", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_AutoGenerateBools2__string_bool_ = global::TUnit.Core.TestMetadataFactory.Create( - "AutoGenerateBools2", "AutoGenerateBools2", 49, - __InvokeTest_AutoGenerateBools2__string_bool_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AutoGenerateBools2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool?), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool?)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool = global::TUnit.Core.TestMetadataFactory.Create( - "ImplicitConversion", "ImplicitConversion", 58, - __InvokeTest_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ImplicitConversion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(OneOf), "enum", new global::TUnit.Core.ConcreteType(typeof(OneOf)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool = global::TUnit.Core.TestMetadataFactory.Create( - "ExcludingAutoGeneratedMatrixValues", "ExcludingAutoGeneratedMatrixValues", 67, - __InvokeTest_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ExcludingAutoGeneratedMatrixValues", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), "enum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_Method1__int = global::TUnit.Core.TestMetadataFactory.Create( - "Method1", "Method1", 116, - __InvokeTest_Method1__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Method1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_Method2__int = global::TUnit.Core.TestMetadataFactory.Create( - "Method2", "Method2", 124, - __InvokeTest_Method2__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Method2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_Method3__int = global::TUnit.Core.TestMetadataFactory.Create( - "Method3", "Method3", 132, - __InvokeTest_Method3__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Method3", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_Method4__int = global::TUnit.Core.TestMetadataFactory.Create( - "Method4", "Method4", 140, - __InvokeTest_Method4__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Method4", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_Exclusion__int_int = global::TUnit.Core.TestMetadataFactory.Create( - "Exclusion", "Exclusion", 148, - __InvokeTest_Exclusion__int_int, __CreateAttributes_1, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Exclusion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item2", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", 197, - __InvokeTest_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke(global::TUnit.TestProject.MatrixTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "flag", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), "enum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: + { + 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)); + } + } + case 3: + { + 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)); + } + } + case 4: + { + 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)); + } + } + case 5: + { + 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)); + } + } + case 6: + { + 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)); + } + } + case 7: + { + 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)); + } + } + case 8: + { + 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)); + } + } + case 9: + { + 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)); + } + } + case 10: + { + 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)); + } + } + case 11: + { + 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)); + } + } + case 12: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_MatrixTest_One__string_int_bool, metadata_MatrixTest_Two__int_int_int_bool, metadata_MatrixTest_Enum__int_TestEnum_TestEnum_, metadata_AutoGenerateBools__string_bool, metadata_AutoGenerateBools2__string_bool_, metadata_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool, metadata_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool, metadata_Method1__int, metadata_Method2__int, metadata_Method3__int, metadata_Method4__int, metadata_Exclusion__int_int, metadata_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + case 1: + { + 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) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.MatrixTest_One", - ClassName = "MatrixTests", MethodName = "MatrixTest_One", FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_One", FilePath = @"", @@ -220,12 +383,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_MatrixTest_One__string_int_bool - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.MatrixTest_Two", - ClassName = "MatrixTests", MethodName = "MatrixTest_Two", FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_Two", FilePath = @"", @@ -235,12 +405,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_MatrixTest_Two__int_int_int_bool - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.MatrixTest_Enum", - ClassName = "MatrixTests", MethodName = "MatrixTest_Enum", FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_Enum", FilePath = @"", @@ -250,12 +427,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_MatrixTest_Enum__int_TestEnum_TestEnum_ - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.AutoGenerateBools", - ClassName = "MatrixTests", MethodName = "AutoGenerateBools", FullyQualifiedName = "TUnit.TestProject.MatrixTests.AutoGenerateBools", FilePath = @"", @@ -265,12 +449,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_AutoGenerateBools__string_bool - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_3, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 3, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.AutoGenerateBools2", - ClassName = "MatrixTests", MethodName = "AutoGenerateBools2", FullyQualifiedName = "TUnit.TestProject.MatrixTests.AutoGenerateBools2", FilePath = @"", @@ -280,12 +471,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_AutoGenerateBools2__string_bool_ - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_4, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 4, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.ImplicitConversion", - ClassName = "MatrixTests", MethodName = "ImplicitConversion", FullyQualifiedName = "TUnit.TestProject.MatrixTests.ImplicitConversion", FilePath = @"", @@ -295,12 +493,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_5, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 5, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.ExcludingAutoGeneratedMatrixValues", - ClassName = "MatrixTests", MethodName = "ExcludingAutoGeneratedMatrixValues", FullyQualifiedName = "TUnit.TestProject.MatrixTests.ExcludingAutoGeneratedMatrixValues", FilePath = @"", @@ -310,12 +515,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_6, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 6, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.Method1", - ClassName = "MatrixTests", MethodName = "Method1", FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method1", FilePath = @"", @@ -325,12 +537,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Method1__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_7, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 7, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.Method2", - ClassName = "MatrixTests", MethodName = "Method2", FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method2", FilePath = @"", @@ -340,12 +559,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Method2__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_8, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 8, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.Method3", - ClassName = "MatrixTests", MethodName = "Method3", FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method3", FilePath = @"", @@ -355,12 +581,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Method3__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_9, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 9, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.Method4", - ClassName = "MatrixTests", MethodName = "Method4", FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method4", FilePath = @"", @@ -370,12 +603,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Method4__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_10, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 10, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.Exclusion", - ClassName = "MatrixTests", MethodName = "Exclusion", FullyQualifiedName = "TUnit.TestProject.MatrixTests.Exclusion", FilePath = @"", @@ -385,12 +625,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Exclusion__int_int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_11, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 11, + CreateAttributes = __Attributes, + AttributeGroupIndex = 1, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", - ClassName = "MatrixTests", MethodName = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", FilePath = @"", @@ -400,671 +647,20 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Attribute[] __CreateAttributes_1() - { - 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::System.Threading.Tasks.ValueTask __InvokeTest_MatrixTest_One__string_int_bool(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_MatrixTest_Two__int_int_int_bool(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_MatrixTest_Enum__int_TestEnum_TestEnum_(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_AutoGenerateBools__string_bool(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_AutoGenerateBools2__string_bool_(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Method1__int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Method2__int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Method3__int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Method4__int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Exclusion__int_int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_MatrixTest_One__string_int_bool(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixTest_One", "MatrixTest_One", 9, - __InvokeTest_MatrixTest_One__string_int_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_One", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_MatrixTest_Two__int_int_int_bool(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixTest_Two", "MatrixTest_Two", 19, - __InvokeTest_MatrixTest_Two__int_int_int_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_Two", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i2", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i3", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[2]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_MatrixTest_Enum__int_TestEnum_TestEnum_(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixTest_Enum", "MatrixTest_Enum", 30, - __InvokeTest_MatrixTest_Enum__int_TestEnum_TestEnum_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_Enum", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(TestEnum), "testEnum", new global::TUnit.Core.ConcreteType(typeof(TestEnum)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(TestEnum?), "testEnum2", new global::TUnit.Core.ConcreteType(typeof(TestEnum?)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_AutoGenerateBools__string_bool(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "AutoGenerateBools", "AutoGenerateBools", 40, - __InvokeTest_AutoGenerateBools__string_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AutoGenerateBools", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_AutoGenerateBools2__string_bool_(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "AutoGenerateBools2", "AutoGenerateBools2", 49, - __InvokeTest_AutoGenerateBools2__string_bool_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AutoGenerateBools2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool?), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool?)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "ImplicitConversion", "ImplicitConversion", 58, - __InvokeTest_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ImplicitConversion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(OneOf), "enum", new global::TUnit.Core.ConcreteType(typeof(OneOf)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "ExcludingAutoGeneratedMatrixValues", "ExcludingAutoGeneratedMatrixValues", 67, - __InvokeTest_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ExcludingAutoGeneratedMatrixValues", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), "enum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Method1__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Method1", "Method1", 116, - __InvokeTest_Method1__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Method1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Method2__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Method2", "Method2", 124, - __InvokeTest_Method2__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Method2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Method3__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Method3", "Method3", 132, - __InvokeTest_Method3__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Method3", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Method4__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Method4", "Method4", 140, - __InvokeTest_Method4__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Method4", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Exclusion__int_int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Exclusion", "Exclusion", 148, - __InvokeTest_Exclusion__int_int, __CreateAttributes_1, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Exclusion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item2", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", 197, - __InvokeTest_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "flag", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), "enum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.MatrixTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } + MethodMetadata = __mm_12, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 12, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_MatrixTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.MatrixTests), TUnit_TestProject_MatrixTests__TestSource.GetTests, TUnit_TestProject_MatrixTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_MatrixTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_MatrixTests__TestSource.Entries); } 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 f03011c053..263ae098e3 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 @@ -7,263 +7,217 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_MethodDataSourceDrivenTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method2", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method_WithAction", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Action), "action", new global::TUnit.Core.ConcreteType(typeof(global::System.Action)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_3 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method3", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_4 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method4", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_5 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_WithBaseReturn", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue), "value", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_6 = global::TUnit.Core.MethodMetadataFactory.Create("EnumerableFuncArrayTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string[]), "strings", new global::TUnit.Core.ConcreteType(typeof(string[])), false, reflectionInfoFactory: static () => 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]) +}); + private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var metadata_DataSource_Method__int = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method", "DataSource_Method", 12, - __InvokeTest_DataSource_Method__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") + case 0: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + 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}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - var metadata_DataSource_Method2__int = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method2", "DataSource_Method2", 19, - __InvokeTest_DataSource_Method2__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method2", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Factory = (dataGeneratorMetadata) => + catch (global::System.Exception ex) { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } - }, - }, - testSessionId: testSessionId - ); - var metadata_DataSource_Method_WithAction__Action = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method_WithAction", "DataSource_Method_WithAction", 26, - __InvokeTest_DataSource_Method_WithAction__Action, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method_WithAction", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Action), "action", new global::TUnit.Core.ConcreteType(typeof(global::System.Action)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("SomeAction") + } + case 1: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeAction(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + 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}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - var metadata_DataSource_Method3__int = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method3", "DataSource_Method3", 33, - __InvokeTest_DataSource_Method3__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method3", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Factory = (dataGeneratorMetadata) => + catch (global::System.Exception ex) { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } - }, - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") + } + case 2: { - Arguments = new object[] { 5 }, - Factory = (dataGeneratorMetadata) => + try { - // Capture Arguments from the attribute - var arguments = new object[] { 5 }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + 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}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - var metadata_DataSource_Method4__int = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method4", "DataSource_Method4", 42, - __InvokeTest_DataSource_Method4__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method4", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Factory = (dataGeneratorMetadata) => + catch (global::System.Exception ex) { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } - }, - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") + } + case 3: { - Arguments = new object[] { "Hello World!", 6, true }, - Factory = (dataGeneratorMetadata) => + try { - // Capture Arguments from the attribute - var arguments = new object[] { "Hello World!", 6, true }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + 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}"); } - return Factory(); } - }, - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Factory = (dataGeneratorMetadata) => + catch (global::System.Exception ex) { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } - }, - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") + } + case 4: { - Arguments = new object[] { "Hello World!", 8, true }, - Factory = (dataGeneratorMetadata) => + try { - // Capture Arguments from the attribute - var arguments = new object[] { "Hello World!", 8, true }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + 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}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - var metadata_DataSource_WithBaseReturn__BaseValue = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_WithBaseReturn", "DataSource_WithBaseReturn", 53, - __InvokeTest_DataSource_WithBaseReturn__BaseValue, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_WithBaseReturn", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue), "value", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("MethodWithBaseReturn") + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + case 5: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.MethodWithBaseReturn(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + 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}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - var metadata_EnumerableFuncArrayTest__string__ = global::TUnit.Core.TestMetadataFactory.Create( - "EnumerableFuncArrayTest", "EnumerableFuncArrayTest", 59, - __InvokeTest_EnumerableFuncArrayTest__string__, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("EnumerableFuncArrayTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string[]), "strings", new global::TUnit.Core.ConcreteType(typeof(string[])), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("EnumerableFuncArrayTestData") + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + case 6: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTestData(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) + case 1: { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + return new global::System.Threading.Tasks.ValueTask(instance.EnumerableFuncArrayTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_DataSource_Method__int, metadata_DataSource_Method2__int, metadata_DataSource_Method_WithAction__Action, metadata_DataSource_Method3__int, metadata_DataSource_Method4__int, metadata_DataSource_WithBaseReturn__BaseValue, metadata_EnumerableFuncArrayTest__string__ }; + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Attribute[] __Attributes(int groupIndex) { - yield return new global::TUnit.Core.TestDescriptor + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } + } + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method", - ClassName = "MethodDataSourceDrivenTests", MethodName = "DataSource_Method", FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method", FilePath = @"", @@ -273,12 +227,30 @@ internal static class TUnit_TestProject_MethodDataSourceDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_Method__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") + { + Factory = (dataGeneratorMetadata) => + { + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + { + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } + return Factory(); + } + }, +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method2", - ClassName = "MethodDataSourceDrivenTests", MethodName = "DataSource_Method2", FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method2", FilePath = @"", @@ -288,12 +260,30 @@ internal static class TUnit_TestProject_MethodDataSourceDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_Method2__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") + { + Factory = (dataGeneratorMetadata) => + { + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + { + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } + return Factory(); + } + }, +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method_WithAction", - ClassName = "MethodDataSourceDrivenTests", MethodName = "DataSource_Method_WithAction", FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method_WithAction", FilePath = @"", @@ -303,12 +293,30 @@ internal static class TUnit_TestProject_MethodDataSourceDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_Method_WithAction__Action - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("SomeAction") + { + Factory = (dataGeneratorMetadata) => + { + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + { + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeAction(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } + return Factory(); + } + }, +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method3", - ClassName = "MethodDataSourceDrivenTests", MethodName = "DataSource_Method3", FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method3", FilePath = @"", @@ -318,554 +326,197 @@ internal static class TUnit_TestProject_MethodDataSourceDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_Method3__int - }; - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method4", - ClassName = "MethodDataSourceDrivenTests", - MethodName = "DataSource_Method4", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method4", - FilePath = @"", - LineNumber = 42, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_Method4__int - }; - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_WithBaseReturn", - ClassName = "MethodDataSourceDrivenTests", - MethodName = "DataSource_WithBaseReturn", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_WithBaseReturn", - FilePath = @"", - LineNumber = 53, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_WithBaseReturn__BaseValue - }; - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTest", - ClassName = "MethodDataSourceDrivenTests", - MethodName = "EnumerableFuncArrayTest", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTest", - FilePath = @"", - LineNumber = 59, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_EnumerableFuncArrayTest__string__ - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method__int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method2__int(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + MethodMetadata = __mm_3, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 3, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - try + Factory = (dataGeneratorMetadata) => { - switch (args.Length) + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - 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}"); + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } + return Factory(); } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method_WithAction__Action(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + }, + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - try + Arguments = new object[] { 5 }, + Factory = (dataGeneratorMetadata) => { - switch (args.Length) + // Capture Arguments from the attribute + var arguments = new object[] { 5 }; + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - 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}"); + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } + return Factory(); } - catch (global::System.Exception ex) + }, +}, + }, + new global::TUnit.Core.TestEntry { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method3__int(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + MethodName = "DataSource_Method4", + FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method4", + FilePath = @"", + LineNumber = 42, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_4, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 4, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - try + Factory = (dataGeneratorMetadata) => { - switch (args.Length) + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - 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}"); + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } + return Factory(); } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method4__int(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + }, + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - try + Arguments = new object[] { "Hello World!", 6, true }, + Factory = (dataGeneratorMetadata) => { - switch (args.Length) + // Capture Arguments from the attribute + var arguments = new object[] { "Hello World!", 6, true }; + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - 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}"); + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } + return Factory(); } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_WithBaseReturn__BaseValue(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + }, + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - try + Factory = (dataGeneratorMetadata) => { - switch (args.Length) + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - 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}"); + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } + return Factory(); } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_EnumerableFuncArrayTest__string__(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + }, + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - try + Arguments = new object[] { "Hello World!", 8, true }, + Factory = (dataGeneratorMetadata) => { - switch (args.Length) + // Capture Arguments from the attribute + var arguments = new object[] { "Hello World!", 8, true }; + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - 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}"); + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } + return Factory(); } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method", "DataSource_Method", 12, - __InvokeTest_DataSource_Method__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method2__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method2", "DataSource_Method2", 19, - __InvokeTest_DataSource_Method2__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method2", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } +}, }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method_WithAction__Action(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata + new global::TUnit.Core.TestEntry { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method_WithAction", "DataSource_Method_WithAction", 26, - __InvokeTest_DataSource_Method_WithAction__Action, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method_WithAction", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Action), "action", new global::TUnit.Core.ConcreteType(typeof(global::System.Action)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + MethodName = "DataSource_WithBaseReturn", + FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_WithBaseReturn", + FilePath = @"", + LineNumber = 53, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_5, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 5, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("MethodWithBaseReturn") { - new global::TUnit.Core.MethodDataSourceAttribute("SomeAction") + Factory = (dataGeneratorMetadata) => { - Factory = (dataGeneratorMetadata) => + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeAction(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.MethodWithBaseReturn(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } - }, + return Factory(); + } }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method3__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method3", "DataSource_Method3", 33, - __InvokeTest_DataSource_Method3__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method3", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Arguments = new object[] { 5 }, - Factory = (dataGeneratorMetadata) => - { - // Capture Arguments from the attribute - var arguments = new object[] { 5 }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } +}, }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method4__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata + new global::TUnit.Core.TestEntry { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method4", "DataSource_Method4", 42, - __InvokeTest_DataSource_Method4__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method4", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + MethodName = "EnumerableFuncArrayTest", + FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTest", + FilePath = @"", + LineNumber = 59, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_6, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 6, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("EnumerableFuncArrayTestData") { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Arguments = new object[] { "Hello World!", 6, true }, - Factory = (dataGeneratorMetadata) => - { - // Capture Arguments from the attribute - var arguments = new object[] { "Hello World!", 6, true }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") + Factory = (dataGeneratorMetadata) => { - Factory = (dataGeneratorMetadata) => + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTestData(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Arguments = new object[] { "Hello World!", 8, true }, - Factory = (dataGeneratorMetadata) => - { - // Capture Arguments from the attribute - var arguments = new object[] { "Hello World!", 8, true }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + foreach (var item in enumerable) + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + } } - return Factory(); - } - }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_WithBaseReturn__BaseValue(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_WithBaseReturn", "DataSource_WithBaseReturn", 53, - __InvokeTest_DataSource_WithBaseReturn__BaseValue, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_WithBaseReturn", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue), "value", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("MethodWithBaseReturn") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + else { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.MethodWithBaseReturn(); yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } - return Factory(); } - }, + return Factory(); + } }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_EnumerableFuncArrayTest__string__(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "EnumerableFuncArrayTest", "EnumerableFuncArrayTest", 59, - __InvokeTest_EnumerableFuncArrayTest__string__, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("EnumerableFuncArrayTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string[]), "strings", new global::TUnit.Core.ConcreteType(typeof(string[])), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("EnumerableFuncArrayTestData") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTestData(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } +}, }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.MethodDataSourceDrivenTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); - } + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_MethodDataSourceDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TUnit_TestProject_MethodDataSourceDrivenTests__TestSource.GetTests, TUnit_TestProject_MethodDataSourceDrivenTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_MethodDataSourceDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_MethodDataSourceDrivenTests__TestSource.Entries); } 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 f03011c053..263ae098e3 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 @@ -7,263 +7,217 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_MethodDataSourceDrivenTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method2", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method_WithAction", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Action), "action", new global::TUnit.Core.ConcreteType(typeof(global::System.Action)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_3 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method3", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_4 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method4", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_5 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_WithBaseReturn", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue), "value", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_6 = global::TUnit.Core.MethodMetadataFactory.Create("EnumerableFuncArrayTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string[]), "strings", new global::TUnit.Core.ConcreteType(typeof(string[])), false, reflectionInfoFactory: static () => 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]) +}); + private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var metadata_DataSource_Method__int = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method", "DataSource_Method", 12, - __InvokeTest_DataSource_Method__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") + case 0: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + 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}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - var metadata_DataSource_Method2__int = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method2", "DataSource_Method2", 19, - __InvokeTest_DataSource_Method2__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method2", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Factory = (dataGeneratorMetadata) => + catch (global::System.Exception ex) { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } - }, - }, - testSessionId: testSessionId - ); - var metadata_DataSource_Method_WithAction__Action = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method_WithAction", "DataSource_Method_WithAction", 26, - __InvokeTest_DataSource_Method_WithAction__Action, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method_WithAction", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Action), "action", new global::TUnit.Core.ConcreteType(typeof(global::System.Action)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("SomeAction") + } + case 1: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeAction(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + 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}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - var metadata_DataSource_Method3__int = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method3", "DataSource_Method3", 33, - __InvokeTest_DataSource_Method3__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method3", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Factory = (dataGeneratorMetadata) => + catch (global::System.Exception ex) { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } - }, - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") + } + case 2: { - Arguments = new object[] { 5 }, - Factory = (dataGeneratorMetadata) => + try { - // Capture Arguments from the attribute - var arguments = new object[] { 5 }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + 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}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - var metadata_DataSource_Method4__int = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method4", "DataSource_Method4", 42, - __InvokeTest_DataSource_Method4__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method4", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Factory = (dataGeneratorMetadata) => + catch (global::System.Exception ex) { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } - }, - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") + } + case 3: { - Arguments = new object[] { "Hello World!", 6, true }, - Factory = (dataGeneratorMetadata) => + try { - // Capture Arguments from the attribute - var arguments = new object[] { "Hello World!", 6, true }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + 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}"); } - return Factory(); } - }, - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Factory = (dataGeneratorMetadata) => + catch (global::System.Exception ex) { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } - }, - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") + } + case 4: { - Arguments = new object[] { "Hello World!", 8, true }, - Factory = (dataGeneratorMetadata) => + try { - // Capture Arguments from the attribute - var arguments = new object[] { "Hello World!", 8, true }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + 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}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - var metadata_DataSource_WithBaseReturn__BaseValue = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_WithBaseReturn", "DataSource_WithBaseReturn", 53, - __InvokeTest_DataSource_WithBaseReturn__BaseValue, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_WithBaseReturn", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue), "value", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("MethodWithBaseReturn") + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + case 5: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.MethodWithBaseReturn(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + 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}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - var metadata_EnumerableFuncArrayTest__string__ = global::TUnit.Core.TestMetadataFactory.Create( - "EnumerableFuncArrayTest", "EnumerableFuncArrayTest", 59, - __InvokeTest_EnumerableFuncArrayTest__string__, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("EnumerableFuncArrayTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string[]), "strings", new global::TUnit.Core.ConcreteType(typeof(string[])), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("EnumerableFuncArrayTestData") + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + case 6: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTestData(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) + case 1: { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + return new global::System.Threading.Tasks.ValueTask(instance.EnumerableFuncArrayTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_DataSource_Method__int, metadata_DataSource_Method2__int, metadata_DataSource_Method_WithAction__Action, metadata_DataSource_Method3__int, metadata_DataSource_Method4__int, metadata_DataSource_WithBaseReturn__BaseValue, metadata_EnumerableFuncArrayTest__string__ }; + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Attribute[] __Attributes(int groupIndex) { - yield return new global::TUnit.Core.TestDescriptor + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } + } + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method", - ClassName = "MethodDataSourceDrivenTests", MethodName = "DataSource_Method", FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method", FilePath = @"", @@ -273,12 +227,30 @@ internal static class TUnit_TestProject_MethodDataSourceDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_Method__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") + { + Factory = (dataGeneratorMetadata) => + { + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + { + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } + return Factory(); + } + }, +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method2", - ClassName = "MethodDataSourceDrivenTests", MethodName = "DataSource_Method2", FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method2", FilePath = @"", @@ -288,12 +260,30 @@ internal static class TUnit_TestProject_MethodDataSourceDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_Method2__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") + { + Factory = (dataGeneratorMetadata) => + { + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + { + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } + return Factory(); + } + }, +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method_WithAction", - ClassName = "MethodDataSourceDrivenTests", MethodName = "DataSource_Method_WithAction", FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method_WithAction", FilePath = @"", @@ -303,12 +293,30 @@ internal static class TUnit_TestProject_MethodDataSourceDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_Method_WithAction__Action - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("SomeAction") + { + Factory = (dataGeneratorMetadata) => + { + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + { + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeAction(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } + return Factory(); + } + }, +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method3", - ClassName = "MethodDataSourceDrivenTests", MethodName = "DataSource_Method3", FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method3", FilePath = @"", @@ -318,554 +326,197 @@ internal static class TUnit_TestProject_MethodDataSourceDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_Method3__int - }; - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method4", - ClassName = "MethodDataSourceDrivenTests", - MethodName = "DataSource_Method4", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method4", - FilePath = @"", - LineNumber = 42, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_Method4__int - }; - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_WithBaseReturn", - ClassName = "MethodDataSourceDrivenTests", - MethodName = "DataSource_WithBaseReturn", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_WithBaseReturn", - FilePath = @"", - LineNumber = 53, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_WithBaseReturn__BaseValue - }; - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTest", - ClassName = "MethodDataSourceDrivenTests", - MethodName = "EnumerableFuncArrayTest", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTest", - FilePath = @"", - LineNumber = 59, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_EnumerableFuncArrayTest__string__ - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method__int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method2__int(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + MethodMetadata = __mm_3, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 3, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - try + Factory = (dataGeneratorMetadata) => { - switch (args.Length) + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - 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}"); + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } + return Factory(); } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method_WithAction__Action(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + }, + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - try + Arguments = new object[] { 5 }, + Factory = (dataGeneratorMetadata) => { - switch (args.Length) + // Capture Arguments from the attribute + var arguments = new object[] { 5 }; + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - 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}"); + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } + return Factory(); } - catch (global::System.Exception ex) + }, +}, + }, + new global::TUnit.Core.TestEntry { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method3__int(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + MethodName = "DataSource_Method4", + FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method4", + FilePath = @"", + LineNumber = 42, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_4, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 4, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - try + Factory = (dataGeneratorMetadata) => { - switch (args.Length) + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - 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}"); + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } + return Factory(); } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method4__int(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + }, + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - try + Arguments = new object[] { "Hello World!", 6, true }, + Factory = (dataGeneratorMetadata) => { - switch (args.Length) + // Capture Arguments from the attribute + var arguments = new object[] { "Hello World!", 6, true }; + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - 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}"); + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } + return Factory(); } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_WithBaseReturn__BaseValue(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + }, + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - try + Factory = (dataGeneratorMetadata) => { - switch (args.Length) + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - 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}"); + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } + return Factory(); } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_EnumerableFuncArrayTest__string__(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + }, + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - try + Arguments = new object[] { "Hello World!", 8, true }, + Factory = (dataGeneratorMetadata) => { - switch (args.Length) + // Capture Arguments from the attribute + var arguments = new object[] { "Hello World!", 8, true }; + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - 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}"); + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } + return Factory(); } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method", "DataSource_Method", 12, - __InvokeTest_DataSource_Method__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method2__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method2", "DataSource_Method2", 19, - __InvokeTest_DataSource_Method2__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method2", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } +}, }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method_WithAction__Action(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata + new global::TUnit.Core.TestEntry { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method_WithAction", "DataSource_Method_WithAction", 26, - __InvokeTest_DataSource_Method_WithAction__Action, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method_WithAction", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Action), "action", new global::TUnit.Core.ConcreteType(typeof(global::System.Action)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + MethodName = "DataSource_WithBaseReturn", + FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_WithBaseReturn", + FilePath = @"", + LineNumber = 53, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_5, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 5, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("MethodWithBaseReturn") { - new global::TUnit.Core.MethodDataSourceAttribute("SomeAction") + Factory = (dataGeneratorMetadata) => { - Factory = (dataGeneratorMetadata) => + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeAction(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.MethodWithBaseReturn(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } - }, + return Factory(); + } }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method3__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method3", "DataSource_Method3", 33, - __InvokeTest_DataSource_Method3__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method3", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Arguments = new object[] { 5 }, - Factory = (dataGeneratorMetadata) => - { - // Capture Arguments from the attribute - var arguments = new object[] { 5 }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } +}, }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method4__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata + new global::TUnit.Core.TestEntry { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method4", "DataSource_Method4", 42, - __InvokeTest_DataSource_Method4__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method4", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + MethodName = "EnumerableFuncArrayTest", + FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTest", + FilePath = @"", + LineNumber = 59, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_6, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 6, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("EnumerableFuncArrayTestData") { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Arguments = new object[] { "Hello World!", 6, true }, - Factory = (dataGeneratorMetadata) => - { - // Capture Arguments from the attribute - var arguments = new object[] { "Hello World!", 6, true }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") + Factory = (dataGeneratorMetadata) => { - Factory = (dataGeneratorMetadata) => + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTestData(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Arguments = new object[] { "Hello World!", 8, true }, - Factory = (dataGeneratorMetadata) => - { - // Capture Arguments from the attribute - var arguments = new object[] { "Hello World!", 8, true }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + foreach (var item in enumerable) + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + } } - return Factory(); - } - }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_WithBaseReturn__BaseValue(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_WithBaseReturn", "DataSource_WithBaseReturn", 53, - __InvokeTest_DataSource_WithBaseReturn__BaseValue, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_WithBaseReturn", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue), "value", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("MethodWithBaseReturn") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + else { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.MethodWithBaseReturn(); yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } - return Factory(); } - }, + return Factory(); + } }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_EnumerableFuncArrayTest__string__(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "EnumerableFuncArrayTest", "EnumerableFuncArrayTest", 59, - __InvokeTest_EnumerableFuncArrayTest__string__, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("EnumerableFuncArrayTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string[]), "strings", new global::TUnit.Core.ConcreteType(typeof(string[])), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("EnumerableFuncArrayTestData") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTestData(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } +}, }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.MethodDataSourceDrivenTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); - } + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_MethodDataSourceDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TUnit_TestProject_MethodDataSourceDrivenTests__TestSource.GetTests, TUnit_TestProject_MethodDataSourceDrivenTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_MethodDataSourceDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_MethodDataSourceDrivenTests__TestSource.Entries); } 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 f03011c053..263ae098e3 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 @@ -7,263 +7,217 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_MethodDataSourceDrivenTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method2", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method_WithAction", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Action), "action", new global::TUnit.Core.ConcreteType(typeof(global::System.Action)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_3 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method3", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_4 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method4", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_5 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_WithBaseReturn", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue), "value", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_6 = global::TUnit.Core.MethodMetadataFactory.Create("EnumerableFuncArrayTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string[]), "strings", new global::TUnit.Core.ConcreteType(typeof(string[])), false, reflectionInfoFactory: static () => 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]) +}); + private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var metadata_DataSource_Method__int = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method", "DataSource_Method", 12, - __InvokeTest_DataSource_Method__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") + case 0: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + 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}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - var metadata_DataSource_Method2__int = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method2", "DataSource_Method2", 19, - __InvokeTest_DataSource_Method2__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method2", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Factory = (dataGeneratorMetadata) => + catch (global::System.Exception ex) { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } - }, - }, - testSessionId: testSessionId - ); - var metadata_DataSource_Method_WithAction__Action = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method_WithAction", "DataSource_Method_WithAction", 26, - __InvokeTest_DataSource_Method_WithAction__Action, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method_WithAction", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Action), "action", new global::TUnit.Core.ConcreteType(typeof(global::System.Action)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("SomeAction") + } + case 1: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeAction(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + 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}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - var metadata_DataSource_Method3__int = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method3", "DataSource_Method3", 33, - __InvokeTest_DataSource_Method3__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method3", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Factory = (dataGeneratorMetadata) => + catch (global::System.Exception ex) { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } - }, - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") + } + case 2: { - Arguments = new object[] { 5 }, - Factory = (dataGeneratorMetadata) => + try { - // Capture Arguments from the attribute - var arguments = new object[] { 5 }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + 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}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - var metadata_DataSource_Method4__int = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method4", "DataSource_Method4", 42, - __InvokeTest_DataSource_Method4__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method4", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Factory = (dataGeneratorMetadata) => + catch (global::System.Exception ex) { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } - }, - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") + } + case 3: { - Arguments = new object[] { "Hello World!", 6, true }, - Factory = (dataGeneratorMetadata) => + try { - // Capture Arguments from the attribute - var arguments = new object[] { "Hello World!", 6, true }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + 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}"); } - return Factory(); } - }, - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Factory = (dataGeneratorMetadata) => + catch (global::System.Exception ex) { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } - }, - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") + } + case 4: { - Arguments = new object[] { "Hello World!", 8, true }, - Factory = (dataGeneratorMetadata) => + try { - // Capture Arguments from the attribute - var arguments = new object[] { "Hello World!", 8, true }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + 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}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - var metadata_DataSource_WithBaseReturn__BaseValue = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_WithBaseReturn", "DataSource_WithBaseReturn", 53, - __InvokeTest_DataSource_WithBaseReturn__BaseValue, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_WithBaseReturn", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue), "value", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("MethodWithBaseReturn") + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + case 5: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.MethodWithBaseReturn(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + 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}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - var metadata_EnumerableFuncArrayTest__string__ = global::TUnit.Core.TestMetadataFactory.Create( - "EnumerableFuncArrayTest", "EnumerableFuncArrayTest", 59, - __InvokeTest_EnumerableFuncArrayTest__string__, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("EnumerableFuncArrayTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string[]), "strings", new global::TUnit.Core.ConcreteType(typeof(string[])), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("EnumerableFuncArrayTestData") + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + case 6: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTestData(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) + case 1: { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + return new global::System.Threading.Tasks.ValueTask(instance.EnumerableFuncArrayTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_DataSource_Method__int, metadata_DataSource_Method2__int, metadata_DataSource_Method_WithAction__Action, metadata_DataSource_Method3__int, metadata_DataSource_Method4__int, metadata_DataSource_WithBaseReturn__BaseValue, metadata_EnumerableFuncArrayTest__string__ }; + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Attribute[] __Attributes(int groupIndex) { - yield return new global::TUnit.Core.TestDescriptor + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } + } + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method", - ClassName = "MethodDataSourceDrivenTests", MethodName = "DataSource_Method", FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method", FilePath = @"", @@ -273,12 +227,30 @@ internal static class TUnit_TestProject_MethodDataSourceDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_Method__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") + { + Factory = (dataGeneratorMetadata) => + { + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + { + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } + return Factory(); + } + }, +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method2", - ClassName = "MethodDataSourceDrivenTests", MethodName = "DataSource_Method2", FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method2", FilePath = @"", @@ -288,12 +260,30 @@ internal static class TUnit_TestProject_MethodDataSourceDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_Method2__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") + { + Factory = (dataGeneratorMetadata) => + { + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + { + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } + return Factory(); + } + }, +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method_WithAction", - ClassName = "MethodDataSourceDrivenTests", MethodName = "DataSource_Method_WithAction", FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method_WithAction", FilePath = @"", @@ -303,12 +293,30 @@ internal static class TUnit_TestProject_MethodDataSourceDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_Method_WithAction__Action - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("SomeAction") + { + Factory = (dataGeneratorMetadata) => + { + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + { + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeAction(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } + return Factory(); + } + }, +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method3", - ClassName = "MethodDataSourceDrivenTests", MethodName = "DataSource_Method3", FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method3", FilePath = @"", @@ -318,554 +326,197 @@ internal static class TUnit_TestProject_MethodDataSourceDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_Method3__int - }; - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method4", - ClassName = "MethodDataSourceDrivenTests", - MethodName = "DataSource_Method4", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method4", - FilePath = @"", - LineNumber = 42, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_Method4__int - }; - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_WithBaseReturn", - ClassName = "MethodDataSourceDrivenTests", - MethodName = "DataSource_WithBaseReturn", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_WithBaseReturn", - FilePath = @"", - LineNumber = 53, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_WithBaseReturn__BaseValue - }; - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTest", - ClassName = "MethodDataSourceDrivenTests", - MethodName = "EnumerableFuncArrayTest", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTest", - FilePath = @"", - LineNumber = 59, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_EnumerableFuncArrayTest__string__ - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method__int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method2__int(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + MethodMetadata = __mm_3, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 3, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - try + Factory = (dataGeneratorMetadata) => { - switch (args.Length) + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - 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}"); + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } + return Factory(); } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method_WithAction__Action(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + }, + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - try + Arguments = new object[] { 5 }, + Factory = (dataGeneratorMetadata) => { - switch (args.Length) + // Capture Arguments from the attribute + var arguments = new object[] { 5 }; + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - 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}"); + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } + return Factory(); } - catch (global::System.Exception ex) + }, +}, + }, + new global::TUnit.Core.TestEntry { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method3__int(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + MethodName = "DataSource_Method4", + FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method4", + FilePath = @"", + LineNumber = 42, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_4, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 4, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - try + Factory = (dataGeneratorMetadata) => { - switch (args.Length) + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - 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}"); + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } + return Factory(); } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method4__int(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + }, + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - try + Arguments = new object[] { "Hello World!", 6, true }, + Factory = (dataGeneratorMetadata) => { - switch (args.Length) + // Capture Arguments from the attribute + var arguments = new object[] { "Hello World!", 6, true }; + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - 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}"); + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } + return Factory(); } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_WithBaseReturn__BaseValue(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + }, + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - try + Factory = (dataGeneratorMetadata) => { - switch (args.Length) + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - 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}"); + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } + return Factory(); } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_EnumerableFuncArrayTest__string__(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + }, + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - try + Arguments = new object[] { "Hello World!", 8, true }, + Factory = (dataGeneratorMetadata) => { - switch (args.Length) + // Capture Arguments from the attribute + var arguments = new object[] { "Hello World!", 8, true }; + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - 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}"); + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } + return Factory(); } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method", "DataSource_Method", 12, - __InvokeTest_DataSource_Method__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method2__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method2", "DataSource_Method2", 19, - __InvokeTest_DataSource_Method2__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method2", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } +}, }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method_WithAction__Action(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata + new global::TUnit.Core.TestEntry { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method_WithAction", "DataSource_Method_WithAction", 26, - __InvokeTest_DataSource_Method_WithAction__Action, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method_WithAction", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Action), "action", new global::TUnit.Core.ConcreteType(typeof(global::System.Action)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + MethodName = "DataSource_WithBaseReturn", + FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_WithBaseReturn", + FilePath = @"", + LineNumber = 53, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_5, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 5, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("MethodWithBaseReturn") { - new global::TUnit.Core.MethodDataSourceAttribute("SomeAction") + Factory = (dataGeneratorMetadata) => { - Factory = (dataGeneratorMetadata) => + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeAction(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.MethodWithBaseReturn(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } - }, + return Factory(); + } }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method3__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method3", "DataSource_Method3", 33, - __InvokeTest_DataSource_Method3__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method3", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Arguments = new object[] { 5 }, - Factory = (dataGeneratorMetadata) => - { - // Capture Arguments from the attribute - var arguments = new object[] { 5 }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } +}, }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method4__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata + new global::TUnit.Core.TestEntry { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method4", "DataSource_Method4", 42, - __InvokeTest_DataSource_Method4__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method4", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + MethodName = "EnumerableFuncArrayTest", + FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTest", + FilePath = @"", + LineNumber = 59, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_6, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 6, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("EnumerableFuncArrayTestData") { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Arguments = new object[] { "Hello World!", 6, true }, - Factory = (dataGeneratorMetadata) => - { - // Capture Arguments from the attribute - var arguments = new object[] { "Hello World!", 6, true }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") + Factory = (dataGeneratorMetadata) => { - Factory = (dataGeneratorMetadata) => + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTestData(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Arguments = new object[] { "Hello World!", 8, true }, - Factory = (dataGeneratorMetadata) => - { - // Capture Arguments from the attribute - var arguments = new object[] { "Hello World!", 8, true }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + foreach (var item in enumerable) + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + } } - return Factory(); - } - }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_WithBaseReturn__BaseValue(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_WithBaseReturn", "DataSource_WithBaseReturn", 53, - __InvokeTest_DataSource_WithBaseReturn__BaseValue, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_WithBaseReturn", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue), "value", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("MethodWithBaseReturn") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + else { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.MethodWithBaseReturn(); yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } - return Factory(); } - }, + return Factory(); + } }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_EnumerableFuncArrayTest__string__(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "EnumerableFuncArrayTest", "EnumerableFuncArrayTest", 59, - __InvokeTest_EnumerableFuncArrayTest__string__, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("EnumerableFuncArrayTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string[]), "strings", new global::TUnit.Core.ConcreteType(typeof(string[])), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("EnumerableFuncArrayTestData") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTestData(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } +}, }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.MethodDataSourceDrivenTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); - } + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_MethodDataSourceDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TUnit_TestProject_MethodDataSourceDrivenTests__TestSource.GetTests, TUnit_TestProject_MethodDataSourceDrivenTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_MethodDataSourceDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_MethodDataSourceDrivenTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MethodDataSource_WithConflictingNamespace.Net4_7.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MethodDataSource_WithConflictingNamespace.Net4_7.verified.txt index 8b2cf6fbd0..ac4577bef9 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MethodDataSource_WithConflictingNamespace.Net4_7.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.MethodDataSource_WithConflictingNamespace.Net4_7.verified.txt @@ -7,263 +7,217 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_MethodDataSourceDrivenTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method2", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method_WithAction", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Action), "action", new global::TUnit.Core.ConcreteType(typeof(global::System.Action)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_3 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method3", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_4 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method4", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_5 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_WithBaseReturn", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue), "value", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_6 = global::TUnit.Core.MethodMetadataFactory.Create("EnumerableFuncArrayTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string[]), "strings", new global::TUnit.Core.ConcreteType(typeof(string[])), false, reflectionInfoFactory: static () => 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]) +}); + private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var metadata_DataSource_Method__int = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method", "DataSource_Method", 12, - __InvokeTest_DataSource_Method__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") + case 0: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + 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}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - var metadata_DataSource_Method2__int = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method2", "DataSource_Method2", 19, - __InvokeTest_DataSource_Method2__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method2", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Factory = (dataGeneratorMetadata) => + catch (global::System.Exception ex) { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } - }, - }, - testSessionId: testSessionId - ); - var metadata_DataSource_Method_WithAction__Action = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method_WithAction", "DataSource_Method_WithAction", 26, - __InvokeTest_DataSource_Method_WithAction__Action, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method_WithAction", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Action), "action", new global::TUnit.Core.ConcreteType(typeof(global::System.Action)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("SomeAction") + } + case 1: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeAction(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + 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}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - var metadata_DataSource_Method3__int = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method3", "DataSource_Method3", 33, - __InvokeTest_DataSource_Method3__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method3", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Factory = (dataGeneratorMetadata) => + catch (global::System.Exception ex) { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } - }, - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") + } + case 2: { - Arguments = new object[] { 5 }, - Factory = (dataGeneratorMetadata) => + try { - // Capture Arguments from the attribute - var arguments = new object[] { 5 }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + 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}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - var metadata_DataSource_Method4__int = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method4", "DataSource_Method4", 42, - __InvokeTest_DataSource_Method4__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method4", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Factory = (dataGeneratorMetadata) => + catch (global::System.Exception ex) { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } - }, - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") + } + case 3: { - Arguments = new object[] { "Hello World!", 6, true }, - Factory = (dataGeneratorMetadata) => + try { - // Capture Arguments from the attribute - var arguments = new object[] { "Hello World!", 6, true }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + 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}"); } - return Factory(); } - }, - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Factory = (dataGeneratorMetadata) => + catch (global::System.Exception ex) { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } - }, - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") + } + case 4: { - Arguments = new object[] { "Hello World!", 8, true }, - Factory = (dataGeneratorMetadata) => + try { - // Capture Arguments from the attribute - var arguments = new object[] { "Hello World!", 8, true }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + 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}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - var metadata_DataSource_WithBaseReturn__BaseValue = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_WithBaseReturn", "DataSource_WithBaseReturn", 53, - __InvokeTest_DataSource_WithBaseReturn__BaseValue, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_WithBaseReturn", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue), "value", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("MethodWithBaseReturn") + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + case 5: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.MethodWithBaseReturn(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + 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}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - var metadata_EnumerableFuncArrayTest__string__ = global::TUnit.Core.TestMetadataFactory.Create( - "EnumerableFuncArrayTest", "EnumerableFuncArrayTest", 59, - __InvokeTest_EnumerableFuncArrayTest__string__, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("EnumerableFuncArrayTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string[]), "strings", new global::TUnit.Core.ConcreteType(typeof(string[])), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("EnumerableFuncArrayTestData") + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + case 6: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTestData(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) + case 1: { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + return new global::System.Threading.Tasks.ValueTask(instance.EnumerableFuncArrayTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_DataSource_Method__int, metadata_DataSource_Method2__int, metadata_DataSource_Method_WithAction__Action, metadata_DataSource_Method3__int, metadata_DataSource_Method4__int, metadata_DataSource_WithBaseReturn__BaseValue, metadata_EnumerableFuncArrayTest__string__ }; + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Attribute[] __Attributes(int groupIndex) { - yield return new global::TUnit.Core.TestDescriptor + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } + } + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method", - ClassName = "MethodDataSourceDrivenTests", MethodName = "DataSource_Method", FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method", FilePath = @"", @@ -273,12 +227,30 @@ internal static class TUnit_TestProject_MethodDataSourceDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_Method__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") + { + Factory = (dataGeneratorMetadata) => + { + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + { + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } + return Factory(); + } + }, +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method2", - ClassName = "MethodDataSourceDrivenTests", MethodName = "DataSource_Method2", FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method2", FilePath = @"", @@ -288,12 +260,30 @@ internal static class TUnit_TestProject_MethodDataSourceDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_Method2__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") + { + Factory = (dataGeneratorMetadata) => + { + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + { + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } + return Factory(); + } + }, +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method_WithAction", - ClassName = "MethodDataSourceDrivenTests", MethodName = "DataSource_Method_WithAction", FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method_WithAction", FilePath = @"", @@ -303,12 +293,30 @@ internal static class TUnit_TestProject_MethodDataSourceDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_Method_WithAction__Action - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("SomeAction") + { + Factory = (dataGeneratorMetadata) => + { + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + { + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeAction(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } + return Factory(); + } + }, +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method3", - ClassName = "MethodDataSourceDrivenTests", MethodName = "DataSource_Method3", FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method3", FilePath = @"", @@ -318,554 +326,197 @@ internal static class TUnit_TestProject_MethodDataSourceDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_Method3__int - }; - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method4", - ClassName = "MethodDataSourceDrivenTests", - MethodName = "DataSource_Method4", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method4", - FilePath = @"", - LineNumber = 42, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_Method4__int - }; - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_WithBaseReturn", - ClassName = "MethodDataSourceDrivenTests", - MethodName = "DataSource_WithBaseReturn", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_WithBaseReturn", - FilePath = @"", - LineNumber = 53, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_WithBaseReturn__BaseValue - }; - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTest", - ClassName = "MethodDataSourceDrivenTests", - MethodName = "EnumerableFuncArrayTest", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTest", - FilePath = @"", - LineNumber = 59, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_EnumerableFuncArrayTest__string__ - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method__int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method2__int(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + MethodMetadata = __mm_3, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 3, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - try + Factory = (dataGeneratorMetadata) => { - switch (args.Length) + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - 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}"); + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } + return Factory(); } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method_WithAction__Action(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + }, + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - try + Arguments = new object[] { 5 }, + Factory = (dataGeneratorMetadata) => { - switch (args.Length) + // Capture Arguments from the attribute + var arguments = new object[] { 5 }; + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - 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}"); + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } + return Factory(); } - catch (global::System.Exception ex) + }, +}, + }, + new global::TUnit.Core.TestEntry { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method3__int(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + MethodName = "DataSource_Method4", + FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method4", + FilePath = @"", + LineNumber = 42, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_4, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 4, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - try + Factory = (dataGeneratorMetadata) => { - switch (args.Length) + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - 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}"); + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } + return Factory(); } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method4__int(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + }, + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - try + Arguments = new object[] { "Hello World!", 6, true }, + Factory = (dataGeneratorMetadata) => { - switch (args.Length) + // Capture Arguments from the attribute + var arguments = new object[] { "Hello World!", 6, true }; + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - 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}"); + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } + return Factory(); } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_WithBaseReturn__BaseValue(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + }, + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - try + Factory = (dataGeneratorMetadata) => { - switch (args.Length) + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - 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}"); + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } + return Factory(); } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_EnumerableFuncArrayTest__string__(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + }, + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - try + Arguments = new object[] { "Hello World!", 8, true }, + Factory = (dataGeneratorMetadata) => { - switch (args.Length) + // Capture Arguments from the attribute + var arguments = new object[] { "Hello World!", 8, true }; + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - 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}"); + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } + return Factory(); } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method", "DataSource_Method", 12, - __InvokeTest_DataSource_Method__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method2__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method2", "DataSource_Method2", 19, - __InvokeTest_DataSource_Method2__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method2", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } +}, }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method_WithAction__Action(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata + new global::TUnit.Core.TestEntry { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method_WithAction", "DataSource_Method_WithAction", 26, - __InvokeTest_DataSource_Method_WithAction__Action, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method_WithAction", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Action), "action", new global::TUnit.Core.ConcreteType(typeof(global::System.Action)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + MethodName = "DataSource_WithBaseReturn", + FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_WithBaseReturn", + FilePath = @"", + LineNumber = 53, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_5, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 5, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("MethodWithBaseReturn") { - new global::TUnit.Core.MethodDataSourceAttribute("SomeAction") + Factory = (dataGeneratorMetadata) => { - Factory = (dataGeneratorMetadata) => + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeAction(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.MethodWithBaseReturn(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } - }, + return Factory(); + } }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method3__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method3", "DataSource_Method3", 33, - __InvokeTest_DataSource_Method3__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method3", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Arguments = new object[] { 5 }, - Factory = (dataGeneratorMetadata) => - { - // Capture Arguments from the attribute - var arguments = new object[] { 5 }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } +}, }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method4__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata + new global::TUnit.Core.TestEntry { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method4", "DataSource_Method4", 42, - __InvokeTest_DataSource_Method4__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method4", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + MethodName = "EnumerableFuncArrayTest", + FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTest", + FilePath = @"", + LineNumber = 59, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_6, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 6, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("EnumerableFuncArrayTestData") { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Arguments = new object[] { "Hello World!", 6, true }, - Factory = (dataGeneratorMetadata) => - { - // Capture Arguments from the attribute - var arguments = new object[] { "Hello World!", 6, true }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") + Factory = (dataGeneratorMetadata) => { - Factory = (dataGeneratorMetadata) => + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTestData(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Arguments = new object[] { "Hello World!", 8, true }, - Factory = (dataGeneratorMetadata) => - { - // Capture Arguments from the attribute - var arguments = new object[] { "Hello World!", 8, true }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + foreach (var item in enumerable) + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + } } - return Factory(); - } - }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_WithBaseReturn__BaseValue(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_WithBaseReturn", "DataSource_WithBaseReturn", 53, - __InvokeTest_DataSource_WithBaseReturn__BaseValue, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_WithBaseReturn", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue), "value", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("MethodWithBaseReturn") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + else { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.MethodWithBaseReturn(); yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } - return Factory(); } - }, + return Factory(); + } }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_EnumerableFuncArrayTest__string__(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "EnumerableFuncArrayTest", "EnumerableFuncArrayTest", 59, - __InvokeTest_EnumerableFuncArrayTest__string__, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("EnumerableFuncArrayTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string[]), "strings", new global::TUnit.Core.ConcreteType(typeof(string[])), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("EnumerableFuncArrayTestData") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTestData(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } +}, }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.MethodDataSourceDrivenTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); - } + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_MethodDataSourceDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TUnit_TestProject_MethodDataSourceDrivenTests__TestSource.GetTests, TUnit_TestProject_MethodDataSourceDrivenTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_MethodDataSourceDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_MethodDataSourceDrivenTests__TestSource.Entries); } 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 046b1445d0..c23fc12831 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 @@ -7,54 +7,76 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_TupleDataSourceDrivenTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TupleDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TupleDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests); - var metadata_DataSource_TupleMethod__int_string_bool = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_TupleMethod", "DataSource_TupleMethod", 8, - __InvokeTest_DataSource_TupleMethod__int_string_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_TupleMethod", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_TupleMethod", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[1]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + 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 __Invoke(global::TUnit.TestProject.TupleDataSourceDrivenTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") + case 0: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.TupleDataSourceDrivenTests.TupleMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + 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}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_DataSource_TupleMethod__int_string_bool }; + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.TupleDataSourceDrivenTests.DataSource_TupleMethod", - ClassName = "TupleDataSourceDrivenTests", MethodName = "DataSource_TupleMethod", FullyQualifiedName = "TUnit.TestProject.TupleDataSourceDrivenTests.DataSource_TupleMethod", FilePath = @"", @@ -64,85 +86,31 @@ internal static class TUnit_TestProject_TupleDataSourceDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_TupleMethod__int_string_bool - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_TupleMethod__int_string_bool(global::TUnit.TestProject.TupleDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") { - try + Factory = (dataGeneratorMetadata) => { - switch (args.Length) + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - 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}"); + var result = global::TUnit.TestProject.TupleDataSourceDrivenTests.TupleMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } + return Factory(); } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_TupleMethod__int_string_bool(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TupleDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_TupleMethod", "DataSource_TupleMethod", 8, - __InvokeTest_DataSource_TupleMethod__int_string_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_TupleMethod", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.TupleDataSourceDrivenTests.TupleMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.TupleDataSourceDrivenTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.TupleDataSourceDrivenTests(); - } +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_TupleDataSourceDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), TUnit_TestProject_TupleDataSourceDrivenTests__TestSource.GetTests, TUnit_TestProject_TupleDataSourceDrivenTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_TupleDataSourceDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_TupleDataSourceDrivenTests__TestSource.Entries); } 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 046b1445d0..c23fc12831 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 @@ -7,54 +7,76 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_TupleDataSourceDrivenTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TupleDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TupleDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests); - var metadata_DataSource_TupleMethod__int_string_bool = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_TupleMethod", "DataSource_TupleMethod", 8, - __InvokeTest_DataSource_TupleMethod__int_string_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_TupleMethod", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_TupleMethod", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[1]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + 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 __Invoke(global::TUnit.TestProject.TupleDataSourceDrivenTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") + case 0: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.TupleDataSourceDrivenTests.TupleMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + 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}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_DataSource_TupleMethod__int_string_bool }; + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.TupleDataSourceDrivenTests.DataSource_TupleMethod", - ClassName = "TupleDataSourceDrivenTests", MethodName = "DataSource_TupleMethod", FullyQualifiedName = "TUnit.TestProject.TupleDataSourceDrivenTests.DataSource_TupleMethod", FilePath = @"", @@ -64,85 +86,31 @@ internal static class TUnit_TestProject_TupleDataSourceDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_TupleMethod__int_string_bool - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_TupleMethod__int_string_bool(global::TUnit.TestProject.TupleDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") { - try + Factory = (dataGeneratorMetadata) => { - switch (args.Length) + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - 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}"); + var result = global::TUnit.TestProject.TupleDataSourceDrivenTests.TupleMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } + return Factory(); } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_TupleMethod__int_string_bool(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TupleDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_TupleMethod", "DataSource_TupleMethod", 8, - __InvokeTest_DataSource_TupleMethod__int_string_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_TupleMethod", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.TupleDataSourceDrivenTests.TupleMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.TupleDataSourceDrivenTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.TupleDataSourceDrivenTests(); - } +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_TupleDataSourceDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), TUnit_TestProject_TupleDataSourceDrivenTests__TestSource.GetTests, TUnit_TestProject_TupleDataSourceDrivenTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_TupleDataSourceDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_TupleDataSourceDrivenTests__TestSource.Entries); } 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 046b1445d0..c23fc12831 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 @@ -7,54 +7,76 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_TupleDataSourceDrivenTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TupleDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TupleDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests); - var metadata_DataSource_TupleMethod__int_string_bool = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_TupleMethod", "DataSource_TupleMethod", 8, - __InvokeTest_DataSource_TupleMethod__int_string_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_TupleMethod", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_TupleMethod", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[1]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + 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 __Invoke(global::TUnit.TestProject.TupleDataSourceDrivenTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") + case 0: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.TupleDataSourceDrivenTests.TupleMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + 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}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_DataSource_TupleMethod__int_string_bool }; + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.TupleDataSourceDrivenTests.DataSource_TupleMethod", - ClassName = "TupleDataSourceDrivenTests", MethodName = "DataSource_TupleMethod", FullyQualifiedName = "TUnit.TestProject.TupleDataSourceDrivenTests.DataSource_TupleMethod", FilePath = @"", @@ -64,85 +86,31 @@ internal static class TUnit_TestProject_TupleDataSourceDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_TupleMethod__int_string_bool - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_TupleMethod__int_string_bool(global::TUnit.TestProject.TupleDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") { - try + Factory = (dataGeneratorMetadata) => { - switch (args.Length) + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - 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}"); + var result = global::TUnit.TestProject.TupleDataSourceDrivenTests.TupleMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } + return Factory(); } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_TupleMethod__int_string_bool(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TupleDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_TupleMethod", "DataSource_TupleMethod", 8, - __InvokeTest_DataSource_TupleMethod__int_string_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_TupleMethod", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.TupleDataSourceDrivenTests.TupleMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.TupleDataSourceDrivenTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.TupleDataSourceDrivenTests(); - } +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_TupleDataSourceDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), TUnit_TestProject_TupleDataSourceDrivenTests__TestSource.GetTests, TUnit_TestProject_TupleDataSourceDrivenTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_TupleDataSourceDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_TupleDataSourceDrivenTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.TupleDataSource_WithConflictingNamespace.Net4_7.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.TupleDataSource_WithConflictingNamespace.Net4_7.verified.txt index 86a905b6ea..b410d7d924 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.TupleDataSource_WithConflictingNamespace.Net4_7.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConflictingNamespaceTests.TupleDataSource_WithConflictingNamespace.Net4_7.verified.txt @@ -7,54 +7,76 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_TupleDataSourceDrivenTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TupleDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TupleDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests); - var metadata_DataSource_TupleMethod__int_string_bool = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_TupleMethod", "DataSource_TupleMethod", 8, - __InvokeTest_DataSource_TupleMethod__int_string_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_TupleMethod", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_TupleMethod", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[1]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + 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 __Invoke(global::TUnit.TestProject.TupleDataSourceDrivenTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") + case 0: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.TupleDataSourceDrivenTests.TupleMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + 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}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_DataSource_TupleMethod__int_string_bool }; + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.TupleDataSourceDrivenTests.DataSource_TupleMethod", - ClassName = "TupleDataSourceDrivenTests", MethodName = "DataSource_TupleMethod", FullyQualifiedName = "TUnit.TestProject.TupleDataSourceDrivenTests.DataSource_TupleMethod", FilePath = @"", @@ -64,85 +86,31 @@ internal static class TUnit_TestProject_TupleDataSourceDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_TupleMethod__int_string_bool - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_TupleMethod__int_string_bool(global::TUnit.TestProject.TupleDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") { - try + Factory = (dataGeneratorMetadata) => { - switch (args.Length) + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - 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}"); + var result = global::TUnit.TestProject.TupleDataSourceDrivenTests.TupleMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } + return Factory(); } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_TupleMethod__int_string_bool(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TupleDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_TupleMethod", "DataSource_TupleMethod", 8, - __InvokeTest_DataSource_TupleMethod__int_string_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_TupleMethod", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.TupleDataSourceDrivenTests.TupleMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.TupleDataSourceDrivenTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.TupleDataSourceDrivenTests(); - } +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_TupleDataSourceDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), TUnit_TestProject_TupleDataSourceDrivenTests__TestSource.GetTests, TUnit_TestProject_TupleDataSourceDrivenTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_TupleDataSourceDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_TupleDataSourceDrivenTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/ConstantArgumentsTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConstantArgumentsTests.Test.verified.txt index 4ca0b62d6b..292a6397e9 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConstantArgumentsTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConstantArgumentsTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,119 +7,211 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_ConstantArgumentsTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ConstantArgumentsTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.ConstantArgumentsTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("String1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "dummy", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("Int", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "dummy", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("Double", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(double), "dummy", new global::TUnit.Core.ConcreteType(typeof(double)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_3 = global::TUnit.Core.MethodMetadataFactory.Create("Float", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(float), "dummy", new global::TUnit.Core.ConcreteType(typeof(float)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_4 = global::TUnit.Core.MethodMetadataFactory.Create("Long", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(long), "dummy", new global::TUnit.Core.ConcreteType(typeof(long)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_5 = global::TUnit.Core.MethodMetadataFactory.Create("UInt", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(uint), "dummy", new global::TUnit.Core.ConcreteType(typeof(uint)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_6 = global::TUnit.Core.MethodMetadataFactory.Create("ULong", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(ulong), "dummy", new global::TUnit.Core.ConcreteType(typeof(ulong)), false, reflectionInfoFactory: static () => 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]) +}); + private static global::TUnit.TestProject.ConstantArgumentsTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ConstantArgumentsTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.ConstantArgumentsTests); - var metadata_String1__string = global::TUnit.Core.TestMetadataFactory.Create( - "String1", "String1", 16, - __InvokeTest_String1__string, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("String1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "dummy", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("123"), - }, - testSessionId: testSessionId - ); - var metadata_Int__int = global::TUnit.Core.TestMetadataFactory.Create( - "Int", "Int", 23, - __InvokeTest_Int__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Int", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "dummy", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(123), - }, - testSessionId: testSessionId - ); - var metadata_Double__double = global::TUnit.Core.TestMetadataFactory.Create( - "Double", "Double", 30, - __InvokeTest_Double__double, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Double", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(double), "dummy", new global::TUnit.Core.ConcreteType(typeof(double)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1.23d), - }, - testSessionId: testSessionId - ); - var metadata_Float__float = global::TUnit.Core.TestMetadataFactory.Create( - "Float", "Float", 37, - __InvokeTest_Float__float, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Float", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(float), "dummy", new global::TUnit.Core.ConcreteType(typeof(float)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1.23000002f), - }, - testSessionId: testSessionId - ); - var metadata_Long__long = global::TUnit.Core.TestMetadataFactory.Create( - "Long", "Long", 44, - __InvokeTest_Long__long, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Long", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(long), "dummy", new global::TUnit.Core.ConcreteType(typeof(long)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(123L), - }, - testSessionId: testSessionId - ); - var metadata_UInt__uint = global::TUnit.Core.TestMetadataFactory.Create( - "UInt", "UInt", 51, - __InvokeTest_UInt__uint, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("UInt", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(uint), "dummy", new global::TUnit.Core.ConcreteType(typeof(uint)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(123U), - }, - testSessionId: testSessionId - ); - var metadata_ULong__ulong = global::TUnit.Core.TestMetadataFactory.Create( - "ULong", "ULong", 58, - __InvokeTest_ULong__ulong, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ULong", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] + return new global::TUnit.TestProject.ConstantArgumentsTests(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke(global::TUnit.TestProject.ConstantArgumentsTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(ulong), "dummy", new global::TUnit.Core.ConcreteType(typeof(ulong)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: + { + 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)); + } + } + case 3: + { + 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)); + } + } + case 4: + { + 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)); + } + } + case 5: + { + 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)); + } + } + case 6: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - new global::TUnit.Core.ArgumentsAttribute(123UL), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_String1__string, metadata_Int__int, metadata_Double__double, metadata_Float__float, metadata_Long__long, metadata_UInt__uint, metadata_ULong__ulong }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.ConstantArgumentsTests.String1", - ClassName = "ConstantArgumentsTests", MethodName = "String1", FullyQualifiedName = "TUnit.TestProject.ConstantArgumentsTests.String1", FilePath = @"", @@ -129,12 +221,19 @@ internal static class TUnit_TestProject_ConstantArgumentsTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_String1__string - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute("123"), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.ConstantArgumentsTests.Int", - ClassName = "ConstantArgumentsTests", MethodName = "Int", FullyQualifiedName = "TUnit.TestProject.ConstantArgumentsTests.Int", FilePath = @"", @@ -144,12 +243,19 @@ internal static class TUnit_TestProject_ConstantArgumentsTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Int__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(123), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.ConstantArgumentsTests.Double", - ClassName = "ConstantArgumentsTests", MethodName = "Double", FullyQualifiedName = "TUnit.TestProject.ConstantArgumentsTests.Double", FilePath = @"", @@ -159,12 +265,19 @@ internal static class TUnit_TestProject_ConstantArgumentsTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Double__double - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(1.23d), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.ConstantArgumentsTests.Float", - ClassName = "ConstantArgumentsTests", MethodName = "Float", FullyQualifiedName = "TUnit.TestProject.ConstantArgumentsTests.Float", FilePath = @"", @@ -174,12 +287,19 @@ internal static class TUnit_TestProject_ConstantArgumentsTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Float__float - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_3, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 3, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(1.23000002f), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.ConstantArgumentsTests.Long", - ClassName = "ConstantArgumentsTests", MethodName = "Long", FullyQualifiedName = "TUnit.TestProject.ConstantArgumentsTests.Long", FilePath = @"", @@ -189,12 +309,19 @@ internal static class TUnit_TestProject_ConstantArgumentsTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Long__long - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_4, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 4, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(123L), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.ConstantArgumentsTests.UInt", - ClassName = "ConstantArgumentsTests", MethodName = "UInt", FullyQualifiedName = "TUnit.TestProject.ConstantArgumentsTests.UInt", FilePath = @"", @@ -204,12 +331,19 @@ internal static class TUnit_TestProject_ConstantArgumentsTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_UInt__uint - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_5, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 5, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(123U), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.ConstantArgumentsTests.ULong", - ClassName = "ConstantArgumentsTests", MethodName = "ULong", FullyQualifiedName = "TUnit.TestProject.ConstantArgumentsTests.ULong", FilePath = @"", @@ -219,359 +353,20 @@ internal static class TUnit_TestProject_ConstantArgumentsTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_ULong__ulong - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_String1__string(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Int__int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Double__double(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Float__float(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Long__long(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_UInt__uint(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_ULong__ulong(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_String1__string(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ConstantArgumentsTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.ConstantArgumentsTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "String1", "String1", 16, - __InvokeTest_String1__string, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("String1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "dummy", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("123"), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Int__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ConstantArgumentsTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.ConstantArgumentsTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Int", "Int", 23, - __InvokeTest_Int__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Int", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "dummy", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(123), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Double__double(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ConstantArgumentsTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.ConstantArgumentsTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Double", "Double", 30, - __InvokeTest_Double__double, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Double", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(double), "dummy", new global::TUnit.Core.ConcreteType(typeof(double)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1.23d), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Float__float(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ConstantArgumentsTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.ConstantArgumentsTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Float", "Float", 37, - __InvokeTest_Float__float, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Float", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(float), "dummy", new global::TUnit.Core.ConcreteType(typeof(float)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1.23000002f), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Long__long(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ConstantArgumentsTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.ConstantArgumentsTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Long", "Long", 44, - __InvokeTest_Long__long, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Long", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(long), "dummy", new global::TUnit.Core.ConcreteType(typeof(long)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(123L), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_UInt__uint(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ConstantArgumentsTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.ConstantArgumentsTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "UInt", "UInt", 51, - __InvokeTest_UInt__uint, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("UInt", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(uint), "dummy", new global::TUnit.Core.ConcreteType(typeof(uint)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(123U), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_ULong__ulong(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ConstantArgumentsTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.ConstantArgumentsTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "ULong", "ULong", 58, - __InvokeTest_ULong__ulong, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ULong", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(ulong), "dummy", new global::TUnit.Core.ConcreteType(typeof(ulong)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(123UL), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.ConstantArgumentsTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.ConstantArgumentsTests(); - } + MethodMetadata = __mm_6, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 6, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(123UL), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_ConstantArgumentsTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.ConstantArgumentsTests), TUnit_TestProject_ConstantArgumentsTests__TestSource.GetTests, TUnit_TestProject_ConstantArgumentsTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_ConstantArgumentsTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_ConstantArgumentsTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/ConstantInBaseClassTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConstantInBaseClassTests.Test.verified.txt index d1e2ebbc5e..e8ff88605b 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConstantInBaseClassTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConstantInBaseClassTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,115 +7,96 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_Bugs__1432_ConstantInBaseClassTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests); - var metadata_SomeTest__string = global::TUnit.Core.TestMetadataFactory.Create( - "SomeTest", "SomeTest", 13, - __InvokeTest_SomeTest__string, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SomeTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("Value"), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_SomeTest__string }; - } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests.SomeTest", - ClassName = "ConstantInBaseClassTests", - MethodName = "SomeTest", - FullyQualifiedName = "TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests.SomeTest", - FilePath = @"", - LineNumber = 13, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_SomeTest__string - }; - } - private static global::System.Attribute[] __CreateAttributes_0() + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("SomeTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) +}); + private static global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; + return new global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests(); } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_SomeTest__string(global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __Invoke(global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) { - try + switch (methodIndex) { - switch (args.Length) + case 0: { - case 1: + try + { + switch (args.Length) { - return new global::System.Threading.Tasks.ValueTask(instance.SomeTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + 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}"); } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); } } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_SomeTest__string(string testSessionId) + private static global::System.Attribute[] __Attributes(int groupIndex) { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests", new global::TUnit.Core.ClassMetadata + switch (groupIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "SomeTest", "SomeTest", 13, - __InvokeTest_SomeTest__string, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SomeTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("Value"), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - internal static global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests CreateInstance(global::System.Type[] typeArgs, object?[] args) + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - return new global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests(); - } + new global::TUnit.Core.TestEntry + { + MethodName = "SomeTest", + FullyQualifiedName = "TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests.SomeTest", + FilePath = @"", + LineNumber = 13, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute("Value"), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__1432_ConstantInBaseClassTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests), TUnit_TestProject_Bugs__1432_ConstantInBaseClassTests__TestSource.GetTests, TUnit_TestProject_Bugs__1432_ConstantInBaseClassTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_Bugs__1432_ConstantInBaseClassTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__1432_ConstantInBaseClassTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/ConstantsInInterpolatedStringsTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConstantsInInterpolatedStringsTests.Test.verified.txt index 2758d117e7..c23a877105 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConstantsInInterpolatedStringsTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConstantsInInterpolatedStringsTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,115 +7,96 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_Bugs__1432_ConstantsInInterpolatedStringsTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests); - var metadata_SomeTest__string = global::TUnit.Core.TestMetadataFactory.Create( - "SomeTest", "SomeTest", 13, - __InvokeTest_SomeTest__string, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SomeTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute($"{"Value"}1"), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_SomeTest__string }; - } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests.SomeTest", - ClassName = "ConstantsInInterpolatedStringsTests", - MethodName = "SomeTest", - FullyQualifiedName = "TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests.SomeTest", - FilePath = @"", - LineNumber = 13, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_SomeTest__string - }; - } - private static global::System.Attribute[] __CreateAttributes_0() + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("SomeTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) +}); + private static global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; + return new global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests(); } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_SomeTest__string(global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __Invoke(global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) { - try + switch (methodIndex) { - switch (args.Length) + case 0: { - case 1: + try + { + switch (args.Length) { - return new global::System.Threading.Tasks.ValueTask(instance.SomeTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + 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}"); } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); } } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_SomeTest__string(string testSessionId) + private static global::System.Attribute[] __Attributes(int groupIndex) { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests", new global::TUnit.Core.ClassMetadata + switch (groupIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "SomeTest", "SomeTest", 13, - __InvokeTest_SomeTest__string, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SomeTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute($"{"Value"}1"), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - internal static global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests CreateInstance(global::System.Type[] typeArgs, object?[] args) + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - return new global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests(); - } + new global::TUnit.Core.TestEntry + { + MethodName = "SomeTest", + FullyQualifiedName = "TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests.SomeTest", + FilePath = @"", + LineNumber = 13, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute($"{"Value"}1"), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__1432_ConstantsInInterpolatedStringsTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests), TUnit_TestProject_Bugs__1432_ConstantsInInterpolatedStringsTests__TestSource.GetTests, TUnit_TestProject_Bugs__1432_ConstantsInInterpolatedStringsTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_Bugs__1432_ConstantsInInterpolatedStringsTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__1432_ConstantsInInterpolatedStringsTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/CustomDisplayNameTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/CustomDisplayNameTests.Test.verified.txt index a4af657101..2ca0bcc782 100644 --- a/TUnit.Core.SourceGenerator.Tests/CustomDisplayNameTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/CustomDisplayNameTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,140 +7,272 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_CustomDisplayNameTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.CustomDisplayNameTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.CustomDisplayNameTests", 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", "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 - }); - var __classType = typeof(global::TUnit.TestProject.CustomDisplayNameTests); - var metadata_Test = global::TUnit.Core.TestMetadataFactory.Create( - "Test", "Test", 11, - __InvokeTest_Test, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - var metadata_Test2 = global::TUnit.Core.TestMetadataFactory.Create( - "Test2", "Test2", 18, - __InvokeTest_Test2, __CreateAttributes_1, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - var metadata_Test3__string_int_bool = global::TUnit.Core.TestMetadataFactory.Create( - "Test3", "Test3", 25, - __InvokeTest_Test3__string_int_bool, __CreateAttributes_2, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test3", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value1", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value2", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("foo", 1, true), - new global::TUnit.Core.ArgumentsAttribute("bar", 2, false), + 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! + } }, - testSessionId: testSessionId - ); - var metadata_MethodDataSourceTest__string = global::TUnit.Core.TestMetadataFactory.Create( - "MethodDataSourceTest", "MethodDataSourceTest", 37, - __InvokeTest_MethodDataSourceTest__string, __CreateAttributes_3, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MethodDataSourceTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "foo", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.CustomDisplayNameTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Test", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("Test2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("Test3", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value1", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value2", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[1]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_3 = global::TUnit.Core.MethodMetadataFactory.Create("MethodDataSourceTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "foo", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_4 = global::TUnit.Core.MethodMetadataFactory.Create("TestParameterNamePrefixBug", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "someValue", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "someValueType", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_5 = global::TUnit.Core.MethodMetadataFactory.Create("PasswordTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "password", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_6 = global::TUnit.Core.MethodMetadataFactory.Create("SameClassConstantTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_7 = global::TUnit.Core.MethodMetadataFactory.Create("DifferentClassConstantTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_8 = global::TUnit.Core.MethodMetadataFactory.Create("NestedClassConstantTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.CustomDisplayNameTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - new global::TUnit.Core.MethodDataSourceAttribute("Method") + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.CustomDisplayNameTests.Method(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + 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}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - var metadata_TestParameterNamePrefixBug__int_string = global::TUnit.Core.TestMetadataFactory.Create( - "TestParameterNamePrefixBug", "TestParameterNamePrefixBug", 45, - __InvokeTest_TestParameterNamePrefixBug__int_string, __CreateAttributes_4, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("TestParameterNamePrefixBug", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "someValue", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "someValueType", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(100, "Type1"), - new global::TUnit.Core.ArgumentsAttribute(200, "Type2"), - new global::TUnit.Core.ArgumentsAttribute(300, "Type1"), - }, - testSessionId: testSessionId - ); - var metadata_PasswordTest__string = global::TUnit.Core.TestMetadataFactory.Create( - "PasswordTest", "PasswordTest", 65, - __InvokeTest_PasswordTest__string, __CreateAttributes_5, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("PasswordTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "password", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + case 3: + { + 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)); + } + } + case 4: + { + 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)); + } + } + case 5: + { + 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)); + } + } + case 6: + { + 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)); + } + } + case 7: + { + 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)); + } + } + case 8: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - new global::TUnit.TestProject.CustomDisplayNameTests.MyGenerator(), - }, - testSessionId: testSessionId - ); - var metadata_SameClassConstantTest = global::TUnit.Core.TestMetadataFactory.Create( - "SameClassConstantTest", "SameClassConstantTest", 72, - __InvokeTest_SameClassConstantTest, __CreateAttributes_6, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SameClassConstantTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - var metadata_DifferentClassConstantTest = global::TUnit.Core.TestMetadataFactory.Create( - "DifferentClassConstantTest", "DifferentClassConstantTest", 79, - __InvokeTest_DifferentClassConstantTest, __CreateAttributes_6, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DifferentClassConstantTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - var metadata_NestedClassConstantTest = global::TUnit.Core.TestMetadataFactory.Create( - "NestedClassConstantTest", "NestedClassConstantTest", 86, - __InvokeTest_NestedClassConstantTest, __CreateAttributes_6, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("NestedClassConstantTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_Test, metadata_Test2, metadata_Test3__string_int_bool, metadata_MethodDataSourceTest__string, metadata_TestParameterNamePrefixBug__int_string, metadata_PasswordTest__string, metadata_SameClassConstantTest, metadata_DifferentClassConstantTest, metadata_NestedClassConstantTest }; + case 0: + { + 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) + ]; + } + case 1: + { + 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) + ]; + } + case 2: + { + 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) + ]; + } + case 3: + { + 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) + ]; + } + case 4: + { + 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) + ]; + } + case 5: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + case 6: + { + 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) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.CustomDisplayNameTests.Test", - ClassName = "CustomDisplayNameTests", MethodName = "Test", FullyQualifiedName = "TUnit.TestProject.CustomDisplayNameTests.Test", FilePath = @"", @@ -150,12 +282,15 @@ internal static class TUnit_TestProject_CustomDisplayNameTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Test - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.CustomDisplayNameTests.Test2", - ClassName = "CustomDisplayNameTests", MethodName = "Test2", FullyQualifiedName = "TUnit.TestProject.CustomDisplayNameTests.Test2", FilePath = @"", @@ -165,12 +300,15 @@ internal static class TUnit_TestProject_CustomDisplayNameTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Test2 - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 1, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.CustomDisplayNameTests.Test3", - ClassName = "CustomDisplayNameTests", MethodName = "Test3", FullyQualifiedName = "TUnit.TestProject.CustomDisplayNameTests.Test3", FilePath = @"", @@ -180,12 +318,20 @@ internal static class TUnit_TestProject_CustomDisplayNameTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Test3__string_int_bool - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 2, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute("foo", 1, true), + new global::TUnit.Core.ArgumentsAttribute("bar", 2, false), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.CustomDisplayNameTests.MethodDataSourceTest", - ClassName = "CustomDisplayNameTests", MethodName = "MethodDataSourceTest", FullyQualifiedName = "TUnit.TestProject.CustomDisplayNameTests.MethodDataSourceTest", FilePath = @"", @@ -195,12 +341,30 @@ internal static class TUnit_TestProject_CustomDisplayNameTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_MethodDataSourceTest__string - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_3, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 3, + CreateAttributes = __Attributes, + AttributeGroupIndex = 3, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("Method") + { + Factory = (dataGeneratorMetadata) => + { + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + { + var result = global::TUnit.TestProject.CustomDisplayNameTests.Method(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } + return Factory(); + } + }, +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.CustomDisplayNameTests.TestParameterNamePrefixBug", - ClassName = "CustomDisplayNameTests", MethodName = "TestParameterNamePrefixBug", FullyQualifiedName = "TUnit.TestProject.CustomDisplayNameTests.TestParameterNamePrefixBug", FilePath = @"", @@ -210,12 +374,21 @@ internal static class TUnit_TestProject_CustomDisplayNameTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_TestParameterNamePrefixBug__int_string - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_4, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 4, + CreateAttributes = __Attributes, + AttributeGroupIndex = 4, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(100, "Type1"), + new global::TUnit.Core.ArgumentsAttribute(200, "Type2"), + new global::TUnit.Core.ArgumentsAttribute(300, "Type1"), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.CustomDisplayNameTests.PasswordTest", - ClassName = "CustomDisplayNameTests", MethodName = "PasswordTest", FullyQualifiedName = "TUnit.TestProject.CustomDisplayNameTests.PasswordTest", FilePath = @"", @@ -225,12 +398,19 @@ internal static class TUnit_TestProject_CustomDisplayNameTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_PasswordTest__string - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_5, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 5, + CreateAttributes = __Attributes, + AttributeGroupIndex = 5, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.TestProject.CustomDisplayNameTests.MyGenerator(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.CustomDisplayNameTests.SameClassConstantTest", - ClassName = "CustomDisplayNameTests", MethodName = "SameClassConstantTest", FullyQualifiedName = "TUnit.TestProject.CustomDisplayNameTests.SameClassConstantTest", FilePath = @"", @@ -240,12 +420,15 @@ internal static class TUnit_TestProject_CustomDisplayNameTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_SameClassConstantTest - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_6, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 6, + CreateAttributes = __Attributes, + AttributeGroupIndex = 6, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.CustomDisplayNameTests.DifferentClassConstantTest", - ClassName = "CustomDisplayNameTests", MethodName = "DifferentClassConstantTest", FullyQualifiedName = "TUnit.TestProject.CustomDisplayNameTests.DifferentClassConstantTest", FilePath = @"", @@ -255,12 +438,15 @@ internal static class TUnit_TestProject_CustomDisplayNameTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DifferentClassConstantTest - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_7, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 7, + CreateAttributes = __Attributes, + AttributeGroupIndex = 6, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.CustomDisplayNameTests.NestedClassConstantTest", - ClassName = "CustomDisplayNameTests", MethodName = "NestedClassConstantTest", FullyQualifiedName = "TUnit.TestProject.CustomDisplayNameTests.NestedClassConstantTest", FilePath = @"", @@ -270,568 +456,16 @@ internal static class TUnit_TestProject_CustomDisplayNameTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_NestedClassConstantTest - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - 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::System.Attribute[] __CreateAttributes_1() - { - 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::System.Attribute[] __CreateAttributes_2() - { - 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::System.Attribute[] __CreateAttributes_3() - { - 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::System.Attribute[] __CreateAttributes_4() - { - 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::System.Attribute[] __CreateAttributes_5() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Attribute[] __CreateAttributes_6() - { - 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::System.Threading.Tasks.ValueTask __InvokeTest_Test(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Test2(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Test3__string_int_bool(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_MethodDataSourceTest__string(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_TestParameterNamePrefixBug__int_string(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_PasswordTest__string(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_SameClassConstantTest(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DifferentClassConstantTest(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_NestedClassConstantTest(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.CustomDisplayNameTests", 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[] - { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.CustomDisplayNameTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Test", "Test", 11, - __InvokeTest_Test, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test2(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.CustomDisplayNameTests", 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[] - { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.CustomDisplayNameTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Test2", "Test2", 18, - __InvokeTest_Test2, __CreateAttributes_1, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test3__string_int_bool(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.CustomDisplayNameTests", 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[] - { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.CustomDisplayNameTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Test3", "Test3", 25, - __InvokeTest_Test3__string_int_bool, __CreateAttributes_2, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test3", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value1", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value2", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("foo", 1, true), - new global::TUnit.Core.ArgumentsAttribute("bar", 2, false), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_MethodDataSourceTest__string(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.CustomDisplayNameTests", 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[] - { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.CustomDisplayNameTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "MethodDataSourceTest", "MethodDataSourceTest", 37, - __InvokeTest_MethodDataSourceTest__string, __CreateAttributes_3, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MethodDataSourceTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "foo", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("Method") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.CustomDisplayNameTests.Method(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + MethodMetadata = __mm_8, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 8, + CreateAttributes = __Attributes, + AttributeGroupIndex = 6, }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_TestParameterNamePrefixBug__int_string(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.CustomDisplayNameTests", 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[] - { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.CustomDisplayNameTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "TestParameterNamePrefixBug", "TestParameterNamePrefixBug", 45, - __InvokeTest_TestParameterNamePrefixBug__int_string, __CreateAttributes_4, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("TestParameterNamePrefixBug", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "someValue", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "someValueType", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(100, "Type1"), - new global::TUnit.Core.ArgumentsAttribute(200, "Type2"), - new global::TUnit.Core.ArgumentsAttribute(300, "Type1"), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_PasswordTest__string(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.CustomDisplayNameTests", 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[] - { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.CustomDisplayNameTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "PasswordTest", "PasswordTest", 65, - __InvokeTest_PasswordTest__string, __CreateAttributes_5, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("PasswordTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "password", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.TestProject.CustomDisplayNameTests.MyGenerator(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_SameClassConstantTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.CustomDisplayNameTests", 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[] - { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.CustomDisplayNameTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "SameClassConstantTest", "SameClassConstantTest", 72, - __InvokeTest_SameClassConstantTest, __CreateAttributes_6, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SameClassConstantTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DifferentClassConstantTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.CustomDisplayNameTests", 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[] - { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.CustomDisplayNameTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DifferentClassConstantTest", "DifferentClassConstantTest", 79, - __InvokeTest_DifferentClassConstantTest, __CreateAttributes_6, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DifferentClassConstantTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_NestedClassConstantTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.CustomDisplayNameTests", 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[] - { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.CustomDisplayNameTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "NestedClassConstantTest", "NestedClassConstantTest", 86, - __InvokeTest_NestedClassConstantTest, __CreateAttributes_6, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("NestedClassConstantTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.CustomDisplayNameTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.CustomDisplayNameTests(); - } + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_CustomDisplayNameTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.CustomDisplayNameTests), TUnit_TestProject_CustomDisplayNameTests__TestSource.GetTests, TUnit_TestProject_CustomDisplayNameTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_CustomDisplayNameTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_CustomDisplayNameTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/DataDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/DataDrivenTests.Test.verified.txt index 7e2f85dd6a..445031327d 100644 --- a/TUnit.Core.SourceGenerator.Tests/DataDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DataDrivenTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,167 +7,291 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_DataDrivenTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.DataDrivenTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("EnumValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.TestEnum), "testEnum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TestEnum)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_3 = global::TUnit.Core.MethodMetadataFactory.Create("NullValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_4 = global::TUnit.Core.MethodMetadataFactory.Create("EmptyString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_5 = global::TUnit.Core.MethodMetadataFactory.Create("NonEmptyString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_6 = global::TUnit.Core.MethodMetadataFactory.Create("BooleanString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool?), "value", new global::TUnit.Core.ConcreteType(typeof(bool?)), true, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_7 = global::TUnit.Core.MethodMetadataFactory.Create("Type", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Type), "value", new global::TUnit.Core.ConcreteType(typeof(global::System.Type)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_8 = global::TUnit.Core.MethodMetadataFactory.Create("IntegerArray", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int[]), "values", new global::TUnit.Core.ConcreteType(typeof(int[])), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_9 = global::TUnit.Core.MethodMetadataFactory.Create("IntMaxValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static global::TUnit.TestProject.DataDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata_DataSource_Method__int = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method", "DataSource_Method", 8, - __InvokeTest_DataSource_Method__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1), - new global::TUnit.Core.ArgumentsAttribute(2), - new global::TUnit.Core.ArgumentsAttribute(3), - }, - testSessionId: testSessionId - ); - var metadata_DataSource_Method__int_string = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method", "DataSource_Method", 17, - __InvokeTest_DataSource_Method__int_string, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1, "String"), - new global::TUnit.Core.ArgumentsAttribute(2, "String2"), - new global::TUnit.Core.ArgumentsAttribute(3, "String3"), - }, - testSessionId: testSessionId - ); - var metadata_EnumValue__TestEnum = global::TUnit.Core.TestMetadataFactory.Create( - "EnumValue", "EnumValue", 26, - __InvokeTest_EnumValue__TestEnum, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("EnumValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.TestEnum), "testEnum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TestEnum)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.One), - new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.Two), - new global::TUnit.Core.ArgumentsAttribute(-1), - }, - testSessionId: testSessionId - ); - var metadata_NullValue__string_ = global::TUnit.Core.TestMetadataFactory.Create( - "NullValue", "NullValue", 35, - __InvokeTest_NullValue__string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("NullValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(null), - }, - testSessionId: testSessionId - ); - var metadata_EmptyString__string_ = global::TUnit.Core.TestMetadataFactory.Create( - "EmptyString", "EmptyString", 42, - __InvokeTest_EmptyString__string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("EmptyString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(""), - }, - testSessionId: testSessionId - ); - var metadata_NonEmptyString__string_ = global::TUnit.Core.TestMetadataFactory.Create( - "NonEmptyString", "NonEmptyString", 49, - __InvokeTest_NonEmptyString__string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("NonEmptyString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("Foo bar!"), - }, - testSessionId: testSessionId - ); - var metadata_BooleanString__bool_ = global::TUnit.Core.TestMetadataFactory.Create( - "BooleanString", "BooleanString", 56, - __InvokeTest_BooleanString__bool_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("BooleanString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool?), "value", new global::TUnit.Core.ConcreteType(typeof(bool?)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(null), - new global::TUnit.Core.ArgumentsAttribute(false), - new global::TUnit.Core.ArgumentsAttribute(true), - }, - testSessionId: testSessionId - ); - var metadata_Type__Type = global::TUnit.Core.TestMetadataFactory.Create( - "Type", "Type", 65, - __InvokeTest_Type__Type, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Type", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Type), "value", new global::TUnit.Core.ConcreteType(typeof(global::System.Type)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(typeof(object)), - }, - testSessionId: testSessionId - ); - var metadata_IntegerArray__int__ = global::TUnit.Core.TestMetadataFactory.Create( - "IntegerArray", "IntegerArray", 72, - __InvokeTest_IntegerArray__int__, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("IntegerArray", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int[]), "values", new global::TUnit.Core.ConcreteType(typeof(int[])), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(new[] { 1, 2, 3 }), - }, - testSessionId: testSessionId - ); - var metadata_IntMaxValue__int = global::TUnit.Core.TestMetadataFactory.Create( - "IntMaxValue", "IntMaxValue", 79, - __InvokeTest_IntMaxValue__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("IntMaxValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] + return new global::TUnit.TestProject.DataDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke(global::TUnit.TestProject.DataDrivenTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: + { + 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)); + } + } + case 3: + { + 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)); + } + } + case 4: + { + 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)); + } + } + case 5: + { + 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)); + } + } + case 6: + { + 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)); + } + } + case 7: + { + 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)); + } + } + case 8: + { + 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)); + } + } + case 9: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - new global::TUnit.Core.ArgumentsAttribute(2147483647), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_DataSource_Method__int, metadata_DataSource_Method__int_string, metadata_EnumValue__TestEnum, metadata_NullValue__string_, metadata_EmptyString__string_, metadata_NonEmptyString__string_, metadata_BooleanString__bool_, metadata_Type__Type, metadata_IntegerArray__int__, metadata_IntMaxValue__int }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.DataSource_Method", - ClassName = "DataDrivenTests", MethodName = "DataSource_Method", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method", FilePath = @"", @@ -177,12 +301,21 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_Method__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(1), + new global::TUnit.Core.ArgumentsAttribute(2), + new global::TUnit.Core.ArgumentsAttribute(3), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.DataSource_Method", - ClassName = "DataDrivenTests", MethodName = "DataSource_Method", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method", FilePath = @"", @@ -192,12 +325,21 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_Method__int_string - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(1, "String"), + new global::TUnit.Core.ArgumentsAttribute(2, "String2"), + new global::TUnit.Core.ArgumentsAttribute(3, "String3"), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.EnumValue", - ClassName = "DataDrivenTests", MethodName = "EnumValue", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EnumValue", FilePath = @"", @@ -207,12 +349,21 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_EnumValue__TestEnum - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.One), + new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.Two), + new global::TUnit.Core.ArgumentsAttribute(-1), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.NullValue", - ClassName = "DataDrivenTests", MethodName = "NullValue", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NullValue", FilePath = @"", @@ -222,12 +373,19 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_NullValue__string_ - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_3, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 3, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(null), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.EmptyString", - ClassName = "DataDrivenTests", MethodName = "EmptyString", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EmptyString", FilePath = @"", @@ -237,12 +395,19 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_EmptyString__string_ - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_4, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 4, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(""), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.NonEmptyString", - ClassName = "DataDrivenTests", MethodName = "NonEmptyString", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NonEmptyString", FilePath = @"", @@ -252,12 +417,19 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_NonEmptyString__string_ - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_5, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 5, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute("Foo bar!"), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.BooleanString", - ClassName = "DataDrivenTests", MethodName = "BooleanString", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.BooleanString", FilePath = @"", @@ -267,12 +439,21 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_BooleanString__bool_ - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_6, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 6, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(null), + new global::TUnit.Core.ArgumentsAttribute(false), + new global::TUnit.Core.ArgumentsAttribute(true), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.Type", - ClassName = "DataDrivenTests", MethodName = "Type", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.Type", FilePath = @"", @@ -282,12 +463,19 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Type__Type - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_7, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 7, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(typeof(object)), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.IntegerArray", - ClassName = "DataDrivenTests", MethodName = "IntegerArray", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntegerArray", FilePath = @"", @@ -297,12 +485,19 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_IntegerArray__int__ - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_8, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 8, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(new[] { 1, 2, 3 }), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataDrivenTests.IntMaxValue", - ClassName = "DataDrivenTests", MethodName = "IntMaxValue", FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntMaxValue", FilePath = @"", @@ -312,522 +507,20 @@ internal static class TUnit_TestProject_DataDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_IntMaxValue__int - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method__int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method__int_string(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_EnumValue__TestEnum(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_NullValue__string_(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_EmptyString__string_(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_NonEmptyString__string_(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_BooleanString__bool_(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Type__Type(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_IntegerArray__int__(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_IntMaxValue__int(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method", "DataSource_Method", 8, - __InvokeTest_DataSource_Method__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1), - new global::TUnit.Core.ArgumentsAttribute(2), - new global::TUnit.Core.ArgumentsAttribute(3), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method__int_string(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method", "DataSource_Method", 17, - __InvokeTest_DataSource_Method__int_string, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1, "String"), - new global::TUnit.Core.ArgumentsAttribute(2, "String2"), - new global::TUnit.Core.ArgumentsAttribute(3, "String3"), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_EnumValue__TestEnum(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "EnumValue", "EnumValue", 26, - __InvokeTest_EnumValue__TestEnum, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("EnumValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.TestEnum), "testEnum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TestEnum)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.One), - new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.Two), - new global::TUnit.Core.ArgumentsAttribute(-1), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_NullValue__string_(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "NullValue", "NullValue", 35, - __InvokeTest_NullValue__string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("NullValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(null), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_EmptyString__string_(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "EmptyString", "EmptyString", 42, - __InvokeTest_EmptyString__string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("EmptyString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(""), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_NonEmptyString__string_(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "NonEmptyString", "NonEmptyString", 49, - __InvokeTest_NonEmptyString__string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("NonEmptyString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("Foo bar!"), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_BooleanString__bool_(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "BooleanString", "BooleanString", 56, - __InvokeTest_BooleanString__bool_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("BooleanString", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool?), "value", new global::TUnit.Core.ConcreteType(typeof(bool?)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(null), - new global::TUnit.Core.ArgumentsAttribute(false), - new global::TUnit.Core.ArgumentsAttribute(true), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Type__Type(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Type", "Type", 65, - __InvokeTest_Type__Type, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Type", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Type), "value", new global::TUnit.Core.ConcreteType(typeof(global::System.Type)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(typeof(object)), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_IntegerArray__int__(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "IntegerArray", "IntegerArray", 72, - __InvokeTest_IntegerArray__int__, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("IntegerArray", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int[]), "values", new global::TUnit.Core.ConcreteType(typeof(int[])), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(new[] { 1, 2, 3 }), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_IntMaxValue__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "IntMaxValue", "IntMaxValue", 79, - __InvokeTest_IntMaxValue__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("IntMaxValue", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(2147483647), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.DataDrivenTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DataDrivenTests(); - } + MethodMetadata = __mm_9, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 9, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(2147483647), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_DataDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.DataDrivenTests), TUnit_TestProject_DataDrivenTests__TestSource.GetTests, TUnit_TestProject_DataDrivenTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_DataDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_DataDrivenTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/DataSourceClassCombinedWithDataSourceMethodTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/DataSourceClassCombinedWithDataSourceMethodTests.Test.verified.txt index 33bcf59f68..7bcd2a0e25 100644 --- a/TUnit.Core.SourceGenerator.Tests/DataSourceClassCombinedWithDataSourceMethodTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DataSourceClassCombinedWithDataSourceMethodTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,118 +7,80 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_DataSourceClassCombinedWithDataSourceMethod__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod", 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", "TestsBase`1"), - Parameters = new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0]) - }, - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod); - var metadata_DataSourceClassCombinedWithDataSourceMethodTest__int = global::TUnit.Core.TestMetadataFactory.Create( - "DataSourceClassCombinedWithDataSourceMethodTest", "DataSourceClassCombinedWithDataSourceMethodTest", 13, - __InvokeTest_DataSourceClassCombinedWithDataSourceMethodTest__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSourceClassCombinedWithDataSourceMethodTest", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "One") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.CommonTestData.One(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, - new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Two") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.CommonTestData.Two(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, - new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Three") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.CommonTestData.Three(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, + global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0]) }, - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("DataSourceClassCombinedWithDataSourceMethodTest", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + 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 __Invoke(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "One") + case 0: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.CommonTestData.One(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + 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}"); } - return Factory(); } - }, - new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Two") - { - Factory = (dataGeneratorMetadata) => + catch (global::System.Exception ex) { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.CommonTestData.Two(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } - }, - new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Three") + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) + { + case 0: { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.CommonTestData.Three(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_DataSourceClassCombinedWithDataSourceMethodTest__int }; + 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") + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod.DataSourceClassCombinedWithDataSourceMethodTest", - ClassName = "DataSourceClassCombinedWithDataSourceMethod", MethodName = "DataSourceClassCombinedWithDataSourceMethodTest", FullyQualifiedName = "TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod.DataSourceClassCombinedWithDataSourceMethodTest", FilePath = @"", @@ -128,152 +90,94 @@ internal static class TUnit_TestProject_DataSourceClassCombinedWithDataSourceMet HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSourceClassCombinedWithDataSourceMethodTest__int - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - 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::System.Threading.Tasks.ValueTask __InvokeTest_DataSourceClassCombinedWithDataSourceMethodTest__int(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "One") { - try + Factory = (dataGeneratorMetadata) => { - switch (args.Length) + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - 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}"); + var result = global::TUnit.TestProject.CommonTestData.One(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } + return Factory(); } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSourceClassCombinedWithDataSourceMethodTest__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod", 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[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0]) - }, - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSourceClassCombinedWithDataSourceMethodTest", "DataSourceClassCombinedWithDataSourceMethodTest", 13, - __InvokeTest_DataSourceClassCombinedWithDataSourceMethodTest__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSourceClassCombinedWithDataSourceMethodTest", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + }, + new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Two") { - new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "One") + Factory = (dataGeneratorMetadata) => { - Factory = (dataGeneratorMetadata) => + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.CommonTestData.One(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); + var result = global::TUnit.TestProject.CommonTestData.Two(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } - }, - new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Two") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.CommonTestData.Two(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, - new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Three") + return Factory(); + } + }, + new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Three") + { + Factory = (dataGeneratorMetadata) => { - Factory = (dataGeneratorMetadata) => + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.CommonTestData.Three(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); + var result = global::TUnit.TestProject.CommonTestData.Three(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } - }, + return Factory(); + } }, - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] +}, + ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "One") { - new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "One") + Factory = (dataGeneratorMetadata) => { - Factory = (dataGeneratorMetadata) => + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.CommonTestData.One(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); + var result = global::TUnit.TestProject.CommonTestData.One(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } - }, - new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Two") + return Factory(); + } + }, + new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Two") + { + Factory = (dataGeneratorMetadata) => { - Factory = (dataGeneratorMetadata) => + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.CommonTestData.Two(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); + var result = global::TUnit.TestProject.CommonTestData.Two(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } - }, - new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Three") + return Factory(); + } + }, + new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Three") + { + Factory = (dataGeneratorMetadata) => { - Factory = (dataGeneratorMetadata) => + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.CommonTestData.Three(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); + var result = global::TUnit.TestProject.CommonTestData.Three(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } - }, + return Factory(); + } }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal 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])); - } +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_DataSourceClassCombinedWithDataSourceMethod__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), TUnit_TestProject_DataSourceClassCombinedWithDataSourceMethod__TestSource.GetTests, TUnit_TestProject_DataSourceClassCombinedWithDataSourceMethod__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_DataSourceClassCombinedWithDataSourceMethod__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_DataSourceClassCombinedWithDataSourceMethod__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Typed.verified.txt b/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Typed.verified.txt index f0f22ca78a..170f4c199c 100644 --- a/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Typed.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Typed.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,91 +7,133 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_DataSourceGeneratorTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataSourceGeneratorTests", 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[] + { + global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[0]), + global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[1]), + global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.DataSourceGeneratorTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("GeneratedData_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("GeneratedData_Method2", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[1]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("GeneratedData_Method3", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[1]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + 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 __Invoke(global::TUnit.TestProject.DataSourceGeneratorTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataSourceGeneratorTests", new global::TUnit.Core.ClassMetadata + switch (methodIndex) { - 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[] + case 0: { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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 - }); - var __classType = typeof(global::TUnit.TestProject.DataSourceGeneratorTests); - var metadata_GeneratedData_Method__int = global::TUnit.Core.TestMetadataFactory.Create( - "GeneratedData_Method", "GeneratedData_Method", 12, - __InvokeTest_GeneratedData_Method__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("GeneratedData_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), - }, - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), - new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_GeneratedData_Method2__int_string_bool = global::TUnit.Core.TestMetadataFactory.Create( - "GeneratedData_Method2", "GeneratedData_Method2", 18, - __InvokeTest_GeneratedData_Method2__int_string_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("GeneratedData_Method2", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), - }, - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), - new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_GeneratedData_Method3__int_string_bool = global::TUnit.Core.TestMetadataFactory.Create( - "GeneratedData_Method3", "GeneratedData_Method3", 24, - __InvokeTest_GeneratedData_Method3__int_string_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("GeneratedData_Method3", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), - }, - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), - new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_GeneratedData_Method__int, metadata_GeneratedData_Method2__int_string_bool, metadata_GeneratedData_Method3__int_string_bool }; + case 0: + { + 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() + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataSourceGeneratorTests.GeneratedData_Method", - ClassName = "DataSourceGeneratorTests", MethodName = "GeneratedData_Method", FullyQualifiedName = "TUnit.TestProject.DataSourceGeneratorTests.GeneratedData_Method", FilePath = @"", @@ -101,12 +143,24 @@ internal static class TUnit_TestProject_DataSourceGeneratorTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_GeneratedData_Method__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), +}, + ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), + new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataSourceGeneratorTests.GeneratedData_Method2", - ClassName = "DataSourceGeneratorTests", MethodName = "GeneratedData_Method2", FullyQualifiedName = "TUnit.TestProject.DataSourceGeneratorTests.GeneratedData_Method2", FilePath = @"", @@ -116,12 +170,24 @@ internal static class TUnit_TestProject_DataSourceGeneratorTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_GeneratedData_Method2__int_string_bool - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), +}, + ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), + new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DataSourceGeneratorTests.GeneratedData_Method3", - ClassName = "DataSourceGeneratorTests", MethodName = "GeneratedData_Method3", FullyQualifiedName = "TUnit.TestProject.DataSourceGeneratorTests.GeneratedData_Method3", FilePath = @"", @@ -131,206 +197,25 @@ internal static class TUnit_TestProject_DataSourceGeneratorTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_GeneratedData_Method3__int_string_bool - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - 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::System.Threading.Tasks.ValueTask __InvokeTest_GeneratedData_Method__int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_GeneratedData_Method2__int_string_bool(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_GeneratedData_Method3__int_string_bool(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_GeneratedData_Method__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataSourceGeneratorTests", 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[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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 - }); - var __classType = typeof(global::TUnit.TestProject.DataSourceGeneratorTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "GeneratedData_Method", "GeneratedData_Method", 12, - __InvokeTest_GeneratedData_Method__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("GeneratedData_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), - }, - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), - new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_GeneratedData_Method2__int_string_bool(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataSourceGeneratorTests", 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[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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 - }); - var __classType = typeof(global::TUnit.TestProject.DataSourceGeneratorTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "GeneratedData_Method2", "GeneratedData_Method2", 18, - __InvokeTest_GeneratedData_Method2__int_string_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("GeneratedData_Method2", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), - }, - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), - new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_GeneratedData_Method3__int_string_bool(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataSourceGeneratorTests", 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[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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 - }); - var __classType = typeof(global::TUnit.TestProject.DataSourceGeneratorTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "GeneratedData_Method3", "GeneratedData_Method3", 24, - __InvokeTest_GeneratedData_Method3__int_string_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("GeneratedData_Method3", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), - }, - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), - new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal 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])); - } + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), +}, + ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), + new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_DataSourceGeneratorTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.DataSourceGeneratorTests), TUnit_TestProject_DataSourceGeneratorTests__TestSource.GetTests, TUnit_TestProject_DataSourceGeneratorTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_DataSourceGeneratorTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_DataSourceGeneratorTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Untyped.verified.txt b/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Untyped.verified.txt index 0be38f81c6..427fc6d975 100644 --- a/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Untyped.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Untyped.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,120 +7,98 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_AutoDataTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AutoDataTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AutoDataTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.AutoDataTests); - var metadata_Test1__string_int_double_bool = global::TUnit.Core.TestMetadataFactory.Create( - "Test1", "Test1", 7, - __InvokeTest_Test1__string_int_double_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value1", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value2", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(double), "value3", new global::TUnit.Core.ConcreteType(typeof(double)), false, reflectionInfoFactory: static () => 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()[2]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value4", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.TestProject.Attributes.AutoDataAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_Test1__string_int_double_bool }; - } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.AutoDataTests.Test1", - ClassName = "AutoDataTests", - MethodName = "Test1", - FullyQualifiedName = "TUnit.TestProject.AutoDataTests.Test1", - FilePath = @"", - LineNumber = 7, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Test1__string_int_double_bool - }; - } - private static global::System.Attribute[] __CreateAttributes_0() + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.AutoDataTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Test1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value1", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value2", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[1]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(double), "value3", new global::TUnit.Core.ConcreteType(typeof(double)), false, reflectionInfoFactory: static () => 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()[2]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value4", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + private static global::TUnit.TestProject.AutoDataTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) { - return - [ - new global::TUnit.Core.TestAttribute() - ]; + return new global::TUnit.TestProject.AutoDataTests(); } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Test1__string_int_double_bool(global::TUnit.TestProject.AutoDataTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __Invoke(global::TUnit.TestProject.AutoDataTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) { - try + switch (methodIndex) { - switch (args.Length) + case 0: { - case 4: + try + { + switch (args.Length) { - 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]))); + 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}"); } - 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)); + } } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); } } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test1__string_int_double_bool(string testSessionId) + private static global::System.Attribute[] __Attributes(int groupIndex) { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AutoDataTests", new global::TUnit.Core.ClassMetadata + switch (groupIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.AutoDataTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Test1", "Test1", 7, - __InvokeTest_Test1__string_int_double_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value1", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value2", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(double), "value3", new global::TUnit.Core.ConcreteType(typeof(double)), false, reflectionInfoFactory: static () => 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()[2]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value4", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.TestProject.Attributes.AutoDataAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - internal static global::TUnit.TestProject.AutoDataTests CreateInstance(global::System.Type[] typeArgs, object?[] args) + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - return new global::TUnit.TestProject.AutoDataTests(); - } + new global::TUnit.Core.TestEntry + { + MethodName = "Test1", + FullyQualifiedName = "TUnit.TestProject.AutoDataTests.Test1", + FilePath = @"", + LineNumber = 7, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.TestProject.Attributes.AutoDataAttribute(), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_AutoDataTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.AutoDataTests), TUnit_TestProject_AutoDataTests__TestSource.GetTests, TUnit_TestProject_AutoDataTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_AutoDataTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_AutoDataTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/DecimalArgumentTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/DecimalArgumentTests.Test.verified.txt index fd0c661749..7ee907669f 100644 --- a/TUnit.Core.SourceGenerator.Tests/DecimalArgumentTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DecimalArgumentTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,198 +7,336 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_DecimalArgumentTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.DecimalArgumentTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Transfer", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "debit", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "credit", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("SimpleDecimal", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "value", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("SmallDecimal", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "value", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_3 = global::TUnit.Core.MethodMetadataFactory.Create("MaxDecimal", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "value", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_4 = global::TUnit.Core.MethodMetadataFactory.Create("MinDecimal", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "value", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_5 = global::TUnit.Core.MethodMetadataFactory.Create("ExplicitDecimalValue", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "value", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_6 = global::TUnit.Core.MethodMetadataFactory.Create("MultipleDecimals", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "a", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "b", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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()[1]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "c", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_7 = global::TUnit.Core.MethodMetadataFactory.Create("Test", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "test", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_8 = global::TUnit.Core.MethodMetadataFactory.Create("TransactionDiscountCalculations", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "amountPaying", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "invoiceBalance", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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()[1]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "invoiceBalanceDue", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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()[2]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "discountAmount", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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()[3]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "appliedDiscountAmount", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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()[4]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "discountAllowedForUser", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_9 = global::TUnit.Core.MethodMetadataFactory.Create("Equality3", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "credit", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_10 = global::TUnit.Core.MethodMetadataFactory.Create("Equality4", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "credit", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_11 = global::TUnit.Core.MethodMetadataFactory.Create("TestMethod", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "batchingSize", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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]) +}); + private static global::TUnit.TestProject.DecimalArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DecimalArgumentTests); - var metadata_Transfer__decimal_decimal = global::TUnit.Core.TestMetadataFactory.Create( - "Transfer", "Transfer", 9, - __InvokeTest_Transfer__decimal_decimal, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Transfer", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "debit", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "credit", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(2_000m, 123_999.00000000000000001m), - new global::TUnit.Core.ArgumentsAttribute(2_000.00000000000000001m, 123_999m), - new global::TUnit.Core.ArgumentsAttribute(2_000.00000000000000001m, 123_999.00000000000000001m), - }, - testSessionId: testSessionId - ); - var metadata_SimpleDecimal__decimal = global::TUnit.Core.TestMetadataFactory.Create( - "SimpleDecimal", "SimpleDecimal", 29, - __InvokeTest_SimpleDecimal__decimal, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SimpleDecimal", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "value", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(123.456m), - }, - testSessionId: testSessionId - ); - var metadata_SmallDecimal__decimal = global::TUnit.Core.TestMetadataFactory.Create( - "SmallDecimal", "SmallDecimal", 36, - __InvokeTest_SmallDecimal__decimal, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SmallDecimal", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "value", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(0.00000000000000001m), - }, - testSessionId: testSessionId - ); - var metadata_MaxDecimal__decimal = global::TUnit.Core.TestMetadataFactory.Create( - "MaxDecimal", "MaxDecimal", 43, - __InvokeTest_MaxDecimal__decimal, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MaxDecimal", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "value", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("79228162514264337593543950335"), - }, - testSessionId: testSessionId - ); - var metadata_MinDecimal__decimal = global::TUnit.Core.TestMetadataFactory.Create( - "MinDecimal", "MinDecimal", 50, - __InvokeTest_MinDecimal__decimal, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MinDecimal", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "value", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("-79228162514264337593543950335"), - }, - testSessionId: testSessionId - ); - var metadata_ExplicitDecimalValue__decimal = global::TUnit.Core.TestMetadataFactory.Create( - "ExplicitDecimalValue", "ExplicitDecimalValue", 57, - __InvokeTest_ExplicitDecimalValue__decimal, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ExplicitDecimalValue", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "value", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("123.456"), - }, - testSessionId: testSessionId - ); - var metadata_MultipleDecimals__decimal_decimal_decimal = global::TUnit.Core.TestMetadataFactory.Create( - "MultipleDecimals", "MultipleDecimals", 64, - __InvokeTest_MultipleDecimals__decimal_decimal_decimal, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MultipleDecimals", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "a", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "b", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "c", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1.1m, 2.2m, 3.3m), - }, - testSessionId: testSessionId - ); - var metadata_Test__decimal = global::TUnit.Core.TestMetadataFactory.Create( - "Test", "Test", 73, - __InvokeTest_Test__decimal, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "test", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(0.5m), - new global::TUnit.Core.ArgumentsAttribute(0.75m), - new global::TUnit.Core.ArgumentsAttribute(1m), - }, - testSessionId: testSessionId - ); - var metadata_TransactionDiscountCalculations__decimal_decimal_decimal_decimal_decimal_bool = global::TUnit.Core.TestMetadataFactory.Create( - "TransactionDiscountCalculations", "TransactionDiscountCalculations", 82, - __InvokeTest_TransactionDiscountCalculations__decimal_decimal_decimal_decimal_decimal_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("TransactionDiscountCalculations", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "amountPaying", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "invoiceBalance", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "invoiceBalanceDue", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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()[2]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "discountAmount", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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()[3]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "appliedDiscountAmount", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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()[4]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "discountAllowedForUser", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(50m, 75m, 70m, 5m, 0m, true), - new global::TUnit.Core.ArgumentsAttribute(70m, 75m, 70m, 5m, 5m, true), - new global::TUnit.Core.ArgumentsAttribute(70m, 75m, 70m, 5m, 0m, false), - }, - testSessionId: testSessionId - ); - var metadata_Equality3__decimal = global::TUnit.Core.TestMetadataFactory.Create( - "Equality3", "Equality3", 91, - __InvokeTest_Equality3__decimal, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Equality3", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "credit", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(2_000.00000000000000001m), - }, - testSessionId: testSessionId - ); - var metadata_Equality4__decimal = global::TUnit.Core.TestMetadataFactory.Create( - "Equality4", "Equality4", 104, - __InvokeTest_Equality4__decimal, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Equality4", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "credit", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(123_999.00000000000000001m), - }, - testSessionId: testSessionId - ); - var metadata_TestMethod__decimal = global::TUnit.Core.TestMetadataFactory.Create( - "TestMethod", "TestMethod", 119, - __InvokeTest_TestMethod__decimal, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("TestMethod", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] + return new global::TUnit.TestProject.DecimalArgumentTests(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke(global::TUnit.TestProject.DecimalArgumentTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "batchingSize", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: + { + 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)); + } + } + case 3: + { + 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)); + } + } + case 4: + { + 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)); + } + } + case 5: + { + 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)); + } + } + case 6: + { + 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)); + } + } + case 7: + { + 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)); + } + } + case 8: + { + 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)); + } + } + case 9: + { + 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)); + } + } + case 10: + { + 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)); + } + } + case 11: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - new global::TUnit.Core.ArgumentsAttribute(42), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_Transfer__decimal_decimal, metadata_SimpleDecimal__decimal, metadata_SmallDecimal__decimal, metadata_MaxDecimal__decimal, metadata_MinDecimal__decimal, metadata_ExplicitDecimalValue__decimal, metadata_MultipleDecimals__decimal_decimal_decimal, metadata_Test__decimal, metadata_TransactionDiscountCalculations__decimal_decimal_decimal_decimal_decimal_bool, metadata_Equality3__decimal, metadata_Equality4__decimal, metadata_TestMethod__decimal }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DecimalArgumentTests.Transfer", - ClassName = "DecimalArgumentTests", MethodName = "Transfer", FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.Transfer", FilePath = @"", @@ -208,12 +346,21 @@ internal static class TUnit_TestProject_DecimalArgumentTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Transfer__decimal_decimal - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(2_000m, 123_999.00000000000000001m), + new global::TUnit.Core.ArgumentsAttribute(2_000.00000000000000001m, 123_999m), + new global::TUnit.Core.ArgumentsAttribute(2_000.00000000000000001m, 123_999.00000000000000001m), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DecimalArgumentTests.SimpleDecimal", - ClassName = "DecimalArgumentTests", MethodName = "SimpleDecimal", FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.SimpleDecimal", FilePath = @"", @@ -223,12 +370,19 @@ internal static class TUnit_TestProject_DecimalArgumentTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_SimpleDecimal__decimal - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(123.456m), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DecimalArgumentTests.SmallDecimal", - ClassName = "DecimalArgumentTests", MethodName = "SmallDecimal", FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.SmallDecimal", FilePath = @"", @@ -238,12 +392,19 @@ internal static class TUnit_TestProject_DecimalArgumentTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_SmallDecimal__decimal - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(0.00000000000000001m), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DecimalArgumentTests.MaxDecimal", - ClassName = "DecimalArgumentTests", MethodName = "MaxDecimal", FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.MaxDecimal", FilePath = @"", @@ -253,12 +414,19 @@ internal static class TUnit_TestProject_DecimalArgumentTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_MaxDecimal__decimal - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_3, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 3, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute("79228162514264337593543950335"), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DecimalArgumentTests.MinDecimal", - ClassName = "DecimalArgumentTests", MethodName = "MinDecimal", FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.MinDecimal", FilePath = @"", @@ -268,12 +436,19 @@ internal static class TUnit_TestProject_DecimalArgumentTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_MinDecimal__decimal - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_4, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 4, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute("-79228162514264337593543950335"), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DecimalArgumentTests.ExplicitDecimalValue", - ClassName = "DecimalArgumentTests", MethodName = "ExplicitDecimalValue", FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.ExplicitDecimalValue", FilePath = @"", @@ -283,12 +458,19 @@ internal static class TUnit_TestProject_DecimalArgumentTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_ExplicitDecimalValue__decimal - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_5, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 5, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute("123.456"), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DecimalArgumentTests.MultipleDecimals", - ClassName = "DecimalArgumentTests", MethodName = "MultipleDecimals", FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.MultipleDecimals", FilePath = @"", @@ -298,12 +480,19 @@ internal static class TUnit_TestProject_DecimalArgumentTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_MultipleDecimals__decimal_decimal_decimal - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_6, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 6, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(1.1m, 2.2m, 3.3m), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DecimalArgumentTests.Test", - ClassName = "DecimalArgumentTests", MethodName = "Test", FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.Test", FilePath = @"", @@ -313,12 +502,21 @@ internal static class TUnit_TestProject_DecimalArgumentTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Test__decimal - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_7, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 7, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(0.5m), + new global::TUnit.Core.ArgumentsAttribute(0.75m), + new global::TUnit.Core.ArgumentsAttribute(1m), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DecimalArgumentTests.TransactionDiscountCalculations", - ClassName = "DecimalArgumentTests", MethodName = "TransactionDiscountCalculations", FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.TransactionDiscountCalculations", FilePath = @"", @@ -328,12 +526,21 @@ internal static class TUnit_TestProject_DecimalArgumentTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_TransactionDiscountCalculations__decimal_decimal_decimal_decimal_decimal_bool - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_8, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 8, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(50m, 75m, 70m, 5m, 0m, true), + new global::TUnit.Core.ArgumentsAttribute(70m, 75m, 70m, 5m, 5m, true), + new global::TUnit.Core.ArgumentsAttribute(70m, 75m, 70m, 5m, 0m, false), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DecimalArgumentTests.Equality3", - ClassName = "DecimalArgumentTests", MethodName = "Equality3", FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.Equality3", FilePath = @"", @@ -343,12 +550,19 @@ internal static class TUnit_TestProject_DecimalArgumentTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Equality3__decimal - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_9, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 9, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(2_000.00000000000000001m), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DecimalArgumentTests.Equality4", - ClassName = "DecimalArgumentTests", MethodName = "Equality4", FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.Equality4", FilePath = @"", @@ -358,12 +572,19 @@ internal static class TUnit_TestProject_DecimalArgumentTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Equality4__decimal - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_10, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 10, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(123_999.00000000000000001m), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.DecimalArgumentTests.TestMethod", - ClassName = "DecimalArgumentTests", MethodName = "TestMethod", FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.TestMethod", FilePath = @"", @@ -373,615 +594,20 @@ internal static class TUnit_TestProject_DecimalArgumentTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_TestMethod__decimal - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Transfer__decimal_decimal(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_SimpleDecimal__decimal(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_SmallDecimal__decimal(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_MaxDecimal__decimal(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_MinDecimal__decimal(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_ExplicitDecimalValue__decimal(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_MultipleDecimals__decimal_decimal_decimal(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Test__decimal(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_TransactionDiscountCalculations__decimal_decimal_decimal_decimal_decimal_bool(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Equality3__decimal(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Equality4__decimal(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_TestMethod__decimal(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Transfer__decimal_decimal(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DecimalArgumentTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Transfer", "Transfer", 9, - __InvokeTest_Transfer__decimal_decimal, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Transfer", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "debit", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "credit", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(2_000m, 123_999.00000000000000001m), - new global::TUnit.Core.ArgumentsAttribute(2_000.00000000000000001m, 123_999m), - new global::TUnit.Core.ArgumentsAttribute(2_000.00000000000000001m, 123_999.00000000000000001m), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_SimpleDecimal__decimal(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DecimalArgumentTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "SimpleDecimal", "SimpleDecimal", 29, - __InvokeTest_SimpleDecimal__decimal, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SimpleDecimal", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "value", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(123.456m), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_SmallDecimal__decimal(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DecimalArgumentTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "SmallDecimal", "SmallDecimal", 36, - __InvokeTest_SmallDecimal__decimal, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SmallDecimal", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "value", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(0.00000000000000001m), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_MaxDecimal__decimal(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DecimalArgumentTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "MaxDecimal", "MaxDecimal", 43, - __InvokeTest_MaxDecimal__decimal, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MaxDecimal", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "value", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("79228162514264337593543950335"), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_MinDecimal__decimal(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DecimalArgumentTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "MinDecimal", "MinDecimal", 50, - __InvokeTest_MinDecimal__decimal, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MinDecimal", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "value", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("-79228162514264337593543950335"), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_ExplicitDecimalValue__decimal(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DecimalArgumentTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "ExplicitDecimalValue", "ExplicitDecimalValue", 57, - __InvokeTest_ExplicitDecimalValue__decimal, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ExplicitDecimalValue", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "value", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("123.456"), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_MultipleDecimals__decimal_decimal_decimal(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DecimalArgumentTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "MultipleDecimals", "MultipleDecimals", 64, - __InvokeTest_MultipleDecimals__decimal_decimal_decimal, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MultipleDecimals", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "a", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "b", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "c", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1.1m, 2.2m, 3.3m), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test__decimal(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DecimalArgumentTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Test", "Test", 73, - __InvokeTest_Test__decimal, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "test", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(0.5m), - new global::TUnit.Core.ArgumentsAttribute(0.75m), - new global::TUnit.Core.ArgumentsAttribute(1m), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_TransactionDiscountCalculations__decimal_decimal_decimal_decimal_decimal_bool(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DecimalArgumentTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "TransactionDiscountCalculations", "TransactionDiscountCalculations", 82, - __InvokeTest_TransactionDiscountCalculations__decimal_decimal_decimal_decimal_decimal_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("TransactionDiscountCalculations", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "amountPaying", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "invoiceBalance", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "invoiceBalanceDue", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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()[2]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "discountAmount", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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()[3]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "appliedDiscountAmount", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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()[4]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "discountAllowedForUser", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(50m, 75m, 70m, 5m, 0m, true), - new global::TUnit.Core.ArgumentsAttribute(70m, 75m, 70m, 5m, 5m, true), - new global::TUnit.Core.ArgumentsAttribute(70m, 75m, 70m, 5m, 0m, false), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Equality3__decimal(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DecimalArgumentTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Equality3", "Equality3", 91, - __InvokeTest_Equality3__decimal, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Equality3", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "credit", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(2_000.00000000000000001m), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Equality4__decimal(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DecimalArgumentTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Equality4", "Equality4", 104, - __InvokeTest_Equality4__decimal, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Equality4", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "credit", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(123_999.00000000000000001m), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_TestMethod__decimal(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.DecimalArgumentTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "TestMethod", "TestMethod", 119, - __InvokeTest_TestMethod__decimal, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("TestMethod", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(decimal), "batchingSize", new global::TUnit.Core.ConcreteType(typeof(decimal)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(42), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.DecimalArgumentTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.DecimalArgumentTests(); - } + MethodMetadata = __mm_11, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 11, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(42), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_DecimalArgumentTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.DecimalArgumentTests), TUnit_TestProject_DecimalArgumentTests__TestSource.GetTests, TUnit_TestProject_DecimalArgumentTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_DecimalArgumentTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_DecimalArgumentTests__TestSource.Entries); } 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 541c2796f2..0aa3823183 100644 --- a/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet10_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet10_0.verified.txt @@ -7,46 +7,86 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_BasicTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.BasicTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.BasicTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata_SynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "SynchronousTest", "SynchronousTest", 5, - __InvokeTest_SynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - var metadata_AsynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "AsynchronousTest", "AsynchronousTest", 11, - __InvokeTest_AsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - var metadata_ValueTaskAsynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "ValueTaskAsynchronousTest", "ValueTaskAsynchronousTest", 17, - __InvokeTest_ValueTaskAsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_SynchronousTest, metadata_AsynchronousTest, metadata_ValueTaskAsynchronousTest }; + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: + { + try + { + return instance.ValueTaskAsynchronousTest(); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Attribute[] __Attributes(int groupIndex) { - yield return new global::TUnit.Core.TestDescriptor + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } + } + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.SynchronousTest", - ClassName = "BasicTests", MethodName = "SynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.SynchronousTest", FilePath = @"", @@ -56,12 +96,15 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_SynchronousTest - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", - ClassName = "BasicTests", MethodName = "AsynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", FilePath = @"", @@ -71,12 +114,15 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_AsynchronousTest - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - ClassName = "BasicTests", MethodName = "ValueTaskAsynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", FilePath = @"", @@ -86,122 +132,16 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_ValueTaskAsynchronousTest - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_SynchronousTest(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_AsynchronousTest(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_ValueTaskAsynchronousTest(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_SynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "SynchronousTest", "SynchronousTest", 5, - __InvokeTest_SynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "AsynchronousTest", "AsynchronousTest", 11, - __InvokeTest_AsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_ValueTaskAsynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "ValueTaskAsynchronousTest", "ValueTaskAsynchronousTest", 17, - __InvokeTest_ValueTaskAsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.BasicTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_BasicTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.BasicTests), TUnit_TestProject_BasicTests__TestSource.GetTests, TUnit_TestProject_BasicTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_BasicTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_BasicTests__TestSource.Entries); } 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 541c2796f2..0aa3823183 100644 --- a/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet8_0.verified.txt @@ -7,46 +7,86 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_BasicTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.BasicTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.BasicTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata_SynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "SynchronousTest", "SynchronousTest", 5, - __InvokeTest_SynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - var metadata_AsynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "AsynchronousTest", "AsynchronousTest", 11, - __InvokeTest_AsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - var metadata_ValueTaskAsynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "ValueTaskAsynchronousTest", "ValueTaskAsynchronousTest", 17, - __InvokeTest_ValueTaskAsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_SynchronousTest, metadata_AsynchronousTest, metadata_ValueTaskAsynchronousTest }; + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: + { + try + { + return instance.ValueTaskAsynchronousTest(); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Attribute[] __Attributes(int groupIndex) { - yield return new global::TUnit.Core.TestDescriptor + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } + } + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.SynchronousTest", - ClassName = "BasicTests", MethodName = "SynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.SynchronousTest", FilePath = @"", @@ -56,12 +96,15 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_SynchronousTest - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", - ClassName = "BasicTests", MethodName = "AsynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", FilePath = @"", @@ -71,12 +114,15 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_AsynchronousTest - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - ClassName = "BasicTests", MethodName = "ValueTaskAsynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", FilePath = @"", @@ -86,122 +132,16 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_ValueTaskAsynchronousTest - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_SynchronousTest(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_AsynchronousTest(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_ValueTaskAsynchronousTest(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_SynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "SynchronousTest", "SynchronousTest", 5, - __InvokeTest_SynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "AsynchronousTest", "AsynchronousTest", 11, - __InvokeTest_AsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_ValueTaskAsynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "ValueTaskAsynchronousTest", "ValueTaskAsynchronousTest", 17, - __InvokeTest_ValueTaskAsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.BasicTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_BasicTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.BasicTests), TUnit_TestProject_BasicTests__TestSource.GetTests, TUnit_TestProject_BasicTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_BasicTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_BasicTests__TestSource.Entries); } 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 541c2796f2..0aa3823183 100644 --- a/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet9_0.verified.txt @@ -7,46 +7,86 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_BasicTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.BasicTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.BasicTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata_SynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "SynchronousTest", "SynchronousTest", 5, - __InvokeTest_SynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - var metadata_AsynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "AsynchronousTest", "AsynchronousTest", 11, - __InvokeTest_AsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - var metadata_ValueTaskAsynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "ValueTaskAsynchronousTest", "ValueTaskAsynchronousTest", 17, - __InvokeTest_ValueTaskAsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_SynchronousTest, metadata_AsynchronousTest, metadata_ValueTaskAsynchronousTest }; + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: + { + try + { + return instance.ValueTaskAsynchronousTest(); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Attribute[] __Attributes(int groupIndex) { - yield return new global::TUnit.Core.TestDescriptor + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } + } + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.SynchronousTest", - ClassName = "BasicTests", MethodName = "SynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.SynchronousTest", FilePath = @"", @@ -56,12 +96,15 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_SynchronousTest - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", - ClassName = "BasicTests", MethodName = "AsynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", FilePath = @"", @@ -71,12 +114,15 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_AsynchronousTest - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - ClassName = "BasicTests", MethodName = "ValueTaskAsynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", FilePath = @"", @@ -86,122 +132,16 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_ValueTaskAsynchronousTest - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_SynchronousTest(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_AsynchronousTest(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_ValueTaskAsynchronousTest(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_SynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "SynchronousTest", "SynchronousTest", 5, - __InvokeTest_SynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "AsynchronousTest", "AsynchronousTest", 11, - __InvokeTest_AsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_ValueTaskAsynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "ValueTaskAsynchronousTest", "ValueTaskAsynchronousTest", 17, - __InvokeTest_ValueTaskAsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.BasicTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_BasicTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.BasicTests), TUnit_TestProject_BasicTests__TestSource.GetTests, TUnit_TestProject_BasicTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_BasicTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_BasicTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.Net4_7.verified.txt b/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.Net4_7.verified.txt index a791373b8c..d67d8a3266 100644 --- a/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.Net4_7.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.Net4_7.verified.txt @@ -7,46 +7,86 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_BasicTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.BasicTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.BasicTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata_SynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "SynchronousTest", "SynchronousTest", 5, - __InvokeTest_SynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - var metadata_AsynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "AsynchronousTest", "AsynchronousTest", 11, - __InvokeTest_AsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - var metadata_ValueTaskAsynchronousTest = global::TUnit.Core.TestMetadataFactory.Create( - "ValueTaskAsynchronousTest", "ValueTaskAsynchronousTest", 17, - __InvokeTest_ValueTaskAsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_SynchronousTest, metadata_AsynchronousTest, metadata_ValueTaskAsynchronousTest }; + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: + { + try + { + return instance.ValueTaskAsynchronousTest(); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Attribute[] __Attributes(int groupIndex) { - yield return new global::TUnit.Core.TestDescriptor + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } + } + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.SynchronousTest", - ClassName = "BasicTests", MethodName = "SynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.SynchronousTest", FilePath = @"", @@ -56,12 +96,15 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_SynchronousTest - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", - ClassName = "BasicTests", MethodName = "AsynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", FilePath = @"", @@ -71,12 +114,15 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_AsynchronousTest - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - ClassName = "BasicTests", MethodName = "ValueTaskAsynchronousTest", FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", FilePath = @"", @@ -86,122 +132,16 @@ internal static class TUnit_TestProject_BasicTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_ValueTaskAsynchronousTest - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_SynchronousTest(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_AsynchronousTest(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_ValueTaskAsynchronousTest(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_SynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "SynchronousTest", "SynchronousTest", 5, - __InvokeTest_SynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SynchronousTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "AsynchronousTest", "AsynchronousTest", 11, - __InvokeTest_AsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AsynchronousTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_ValueTaskAsynchronousTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.BasicTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "ValueTaskAsynchronousTest", "ValueTaskAsynchronousTest", 17, - __InvokeTest_ValueTaskAsynchronousTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ValueTaskAsynchronousTest", __classType, typeof(global::System.Threading.Tasks.ValueTask), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.BasicTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.BasicTests(); - } + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_BasicTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.BasicTests), TUnit_TestProject_BasicTests__TestSource.GetTests, TUnit_TestProject_BasicTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_BasicTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_BasicTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/EnumMemberNamesTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/EnumMemberNamesTests.Test.verified.txt index df78ad1797..7cc471974d 100644 --- a/TUnit.Core.SourceGenerator.Tests/EnumMemberNamesTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/EnumMemberNamesTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,120 +7,99 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_Bugs__1432_EnumMemberNamesTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests); - var metadata_SomeTest__string = global::TUnit.Core.TestMetadataFactory.Create( - "SomeTest", "SomeTest", 8, - __InvokeTest_SomeTest__string, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SomeTest", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("A"), - new global::TUnit.Core.ArgumentsAttribute("B"), - new global::TUnit.Core.ArgumentsAttribute("C"), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_SomeTest__string }; - } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.Bugs._1432.EnumMemberNamesTests.SomeTest", - ClassName = "EnumMemberNamesTests", - MethodName = "SomeTest", - FullyQualifiedName = "TUnit.TestProject.Bugs._1432.EnumMemberNamesTests.SomeTest", - FilePath = @"", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_SomeTest__string - }; - } - private static global::System.Attribute[] __CreateAttributes_0() + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("SomeTest", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) +}); + private static global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; + return new global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests(); } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_SomeTest__string(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __Invoke(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) { - try + switch (methodIndex) { - switch (args.Length) + case 0: { - case 1: + try + { + switch (args.Length) { - instance.SomeTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); + 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}"); } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); } } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_SomeTest__string(string testSessionId) + private static global::System.Attribute[] __Attributes(int groupIndex) { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests", new global::TUnit.Core.ClassMetadata + switch (groupIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "SomeTest", "SomeTest", 8, - __InvokeTest_SomeTest__string, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SomeTest", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("A"), - new global::TUnit.Core.ArgumentsAttribute("B"), - new global::TUnit.Core.ArgumentsAttribute("C"), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - internal static global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests CreateInstance(global::System.Type[] typeArgs, object?[] args) + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - return new global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests(); - } + new global::TUnit.Core.TestEntry + { + MethodName = "SomeTest", + FullyQualifiedName = "TUnit.TestProject.Bugs._1432.EnumMemberNamesTests.SomeTest", + FilePath = @"", + LineNumber = 8, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute("A"), + new global::TUnit.Core.ArgumentsAttribute("B"), + new global::TUnit.Core.ArgumentsAttribute("C"), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__1432_EnumMemberNamesTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests), TUnit_TestProject_Bugs__1432_EnumMemberNamesTests__TestSource.GetTests, TUnit_TestProject_Bugs__1432_EnumMemberNamesTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_Bugs__1432_EnumMemberNamesTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__1432_EnumMemberNamesTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/EnumerableDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/EnumerableDataSourceDrivenTests.Test.verified.txt index 873dc4b5a1..51d0f78112 100644 --- a/TUnit.Core.SourceGenerator.Tests/EnumerableDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/EnumerableDataSourceDrivenTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,130 +7,120 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_EnumerableDataSourceDrivenTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.EnumerableDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.EnumerableDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests); - var metadata_DataSource_Method__int = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method", "DataSource_Method", 8, - __InvokeTest_DataSource_Method__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_WithBaseReturn", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests.BaseValue), "value", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests.BaseValue)), false, reflectionInfoFactory: static () => 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]) +}); + 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 __Invoke(global::TUnit.TestProject.EnumerableDataSourceDrivenTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") + case 0: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.EnumerableDataSourceDrivenTests.SomeMethod(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) + case 1: { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + return new global::System.Threading.Tasks.ValueTask(instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - var metadata_DataSource_Method2__int = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method2", "DataSource_Method2", 15, - __InvokeTest_DataSource_Method2__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + case 1: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.EnumerableDataSourceDrivenTests.SomeMethod(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) + case 1: { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + return new global::System.Threading.Tasks.ValueTask(instance.DataSource_Method2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - var metadata_DataSource_WithBaseReturn__BaseValue = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_WithBaseReturn", "DataSource_WithBaseReturn", 22, - __InvokeTest_DataSource_WithBaseReturn__BaseValue, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_WithBaseReturn", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests.BaseValue), "value", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests.BaseValue)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("MethodWithBaseReturn") + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + case 2: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.EnumerableDataSourceDrivenTests.MethodWithBaseReturn(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) + case 1: { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + instance.DataSource_WithBaseReturn(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_DataSource_Method__int, metadata_DataSource_Method2__int, metadata_DataSource_WithBaseReturn__BaseValue }; + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Attribute[] __Attributes(int groupIndex) { - yield return new global::TUnit.Core.TestDescriptor + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } + } + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.EnumerableDataSourceDrivenTests.DataSource_Method", - ClassName = "EnumerableDataSourceDrivenTests", MethodName = "DataSource_Method", FullyQualifiedName = "TUnit.TestProject.EnumerableDataSourceDrivenTests.DataSource_Method", FilePath = @"", @@ -140,12 +130,40 @@ internal static class TUnit_TestProject_EnumerableDataSourceDrivenTests__TestSou HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_Method__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") + { + Factory = (dataGeneratorMetadata) => + { + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + { + var result = global::TUnit.TestProject.EnumerableDataSourceDrivenTests.SomeMethod(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) + { + foreach (var item in enumerable) + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + } + } + else + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } + } + return Factory(); + } + }, +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.EnumerableDataSourceDrivenTests.DataSource_Method2", - ClassName = "EnumerableDataSourceDrivenTests", MethodName = "DataSource_Method2", FullyQualifiedName = "TUnit.TestProject.EnumerableDataSourceDrivenTests.DataSource_Method2", FilePath = @"", @@ -155,12 +173,40 @@ internal static class TUnit_TestProject_EnumerableDataSourceDrivenTests__TestSou HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_Method2__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") + { + Factory = (dataGeneratorMetadata) => + { + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + { + var result = global::TUnit.TestProject.EnumerableDataSourceDrivenTests.SomeMethod(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) + { + foreach (var item in enumerable) + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + } + } + else + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } + } + return Factory(); + } + }, +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.EnumerableDataSourceDrivenTests.DataSource_WithBaseReturn", - ClassName = "EnumerableDataSourceDrivenTests", MethodName = "DataSource_WithBaseReturn", FullyQualifiedName = "TUnit.TestProject.EnumerableDataSourceDrivenTests.DataSource_WithBaseReturn", FilePath = @"", @@ -170,231 +216,41 @@ internal static class TUnit_TestProject_EnumerableDataSourceDrivenTests__TestSou HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_WithBaseReturn__BaseValue - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method__int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method2__int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_WithBaseReturn__BaseValue(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.EnumerableDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method", "DataSource_Method", 8, - __InvokeTest_DataSource_Method__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("MethodWithBaseReturn") { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") + Factory = (dataGeneratorMetadata) => { - Factory = (dataGeneratorMetadata) => + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + var result = global::TUnit.TestProject.EnumerableDataSourceDrivenTests.MethodWithBaseReturn(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) { - var result = global::TUnit.TestProject.EnumerableDataSourceDrivenTests.SomeMethod(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) + foreach (var item in enumerable) { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); } } - return Factory(); - } - }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method2__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.EnumerableDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method2", "DataSource_Method2", 15, - __InvokeTest_DataSource_Method2__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + else { - var result = global::TUnit.TestProject.EnumerableDataSourceDrivenTests.SomeMethod(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } - return Factory(); } - }, + return Factory(); + } }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_WithBaseReturn__BaseValue(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.EnumerableDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_WithBaseReturn", "DataSource_WithBaseReturn", 22, - __InvokeTest_DataSource_WithBaseReturn__BaseValue, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_WithBaseReturn", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests.BaseValue), "value", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests.BaseValue)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("MethodWithBaseReturn") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.EnumerableDataSourceDrivenTests.MethodWithBaseReturn(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } +}, }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.EnumerableDataSourceDrivenTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.EnumerableDataSourceDrivenTests(); - } + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_EnumerableDataSourceDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests), TUnit_TestProject_EnumerableDataSourceDrivenTests__TestSource.GetTests, TUnit_TestProject_EnumerableDataSourceDrivenTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_EnumerableDataSourceDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_EnumerableDataSourceDrivenTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/EnumerableTupleDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/EnumerableTupleDataSourceDrivenTests.Test.verified.txt index d3ce688b1c..5910a99bd2 100644 --- a/TUnit.Core.SourceGenerator.Tests/EnumerableTupleDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/EnumerableTupleDataSourceDrivenTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,86 +7,76 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_EnumerableTupleDataSourceDrivenTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests); - var metadata_DataSource_TupleMethod__int_string_bool = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_TupleMethod", "DataSource_TupleMethod", 8, - __InvokeTest_DataSource_TupleMethod__int_string_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_TupleMethod", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_TupleMethod", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[1]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + 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 __Invoke(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") + case 0: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests.TupleMethod(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) + case 3: { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + 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); } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } + default: + throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); } - return Factory(); } - }, - new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") - { - Factory = (dataGeneratorMetadata) => + catch (global::System.Exception ex) { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests.NamedTupleMethod(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } - }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_DataSource_TupleMethod__int_string_bool }; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.EnumerableTupleDataSourceDrivenTests.DataSource_TupleMethod", - ClassName = "EnumerableTupleDataSourceDrivenTests", MethodName = "DataSource_TupleMethod", FullyQualifiedName = "TUnit.TestProject.EnumerableTupleDataSourceDrivenTests.DataSource_TupleMethod", FilePath = @"", @@ -96,117 +86,63 @@ internal static class TUnit_TestProject_EnumerableTupleDataSourceDrivenTests__Te HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_TupleMethod__int_string_bool - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_TupleMethod__int_string_bool(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") { - try + Factory = (dataGeneratorMetadata) => { - switch (args.Length) + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - case 3: + var result = global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests.TupleMethod(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) + { + foreach (var item in enumerable) { - 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); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); } - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); + } + else + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } } + return Factory(); } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_TupleMethod__int_string_bool(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_TupleMethod", "DataSource_TupleMethod", 8, - __InvokeTest_DataSource_TupleMethod__int_string_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_TupleMethod", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + }, + new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") { - new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") + Factory = (dataGeneratorMetadata) => { - Factory = (dataGeneratorMetadata) => + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + var result = global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests.NamedTupleMethod(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) { - var result = global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests.TupleMethod(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else + foreach (var item in enumerable) { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); } } - return Factory(); - } - }, - new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + else { - var result = global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests.NamedTupleMethod(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } - return Factory(); } - }, + return Factory(); + } }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests(); - } +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_EnumerableTupleDataSourceDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests), TUnit_TestProject_EnumerableTupleDataSourceDrivenTests__TestSource.GetTests, TUnit_TestProject_EnumerableTupleDataSourceDrivenTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_EnumerableTupleDataSourceDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_EnumerableTupleDataSourceDrivenTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/ExpectedArgumentTypeTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ExpectedArgumentTypeTests.Test.verified.txt index 1ad4fde735..e422b8139a 100644 --- a/TUnit.Core.SourceGenerator.Tests/ExpectedArgumentTypeTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ExpectedArgumentTypeTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,76 +7,99 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_ExpectedArgumentTypeTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ExpectedArgumentTypeTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ExpectedArgumentTypeTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.ExpectedArgumentTypeTests); - var metadata_TypedArguments__object_Type = global::TUnit.Core.TestMetadataFactory.Create( - "TypedArguments", "TypedArguments", 8, - __InvokeTest_TypedArguments__object_Type, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("TypedArguments", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(object), "value", new global::TUnit.Core.ConcreteType(typeof(object)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Type), "expectedType", new global::TUnit.Core.ConcreteType(typeof(global::System.Type)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(0d, typeof(double)), - new global::TUnit.Core.ArgumentsAttribute(0f, typeof(float)), - new global::TUnit.Core.ArgumentsAttribute((sbyte)0, typeof(sbyte)), - new global::TUnit.Core.ArgumentsAttribute((byte)0, typeof(byte)), - new global::TUnit.Core.ArgumentsAttribute((short)0, typeof(short)), - new global::TUnit.Core.ArgumentsAttribute((ushort)0, typeof(ushort)), - new global::TUnit.Core.ArgumentsAttribute(0, typeof(int)), - new global::TUnit.Core.ArgumentsAttribute((uint)0, typeof(uint)), - new global::TUnit.Core.ArgumentsAttribute(0u, typeof(uint)), - new global::TUnit.Core.ArgumentsAttribute((long)0, typeof(long)), - new global::TUnit.Core.ArgumentsAttribute(0L, typeof(long)), - new global::TUnit.Core.ArgumentsAttribute((ulong)0, typeof(ulong)), - new global::TUnit.Core.ArgumentsAttribute(0UL, typeof(ulong)), - }, - testSessionId: testSessionId - ); - var metadata_EnumTypes__object_Type_Type = global::TUnit.Core.TestMetadataFactory.Create( - "EnumTypes", "EnumTypes", 25, - __InvokeTest_EnumTypes__object_Type_Type, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("EnumTypes", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.ExpectedArgumentTypeTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("TypedArguments", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(object), "value", new global::TUnit.Core.ConcreteType(typeof(object)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Type), "expectedType", new global::TUnit.Core.ConcreteType(typeof(global::System.Type)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("EnumTypes", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(object), "value", new global::TUnit.Core.ConcreteType(typeof(object)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Type), "expectedValueType", new global::TUnit.Core.ConcreteType(typeof(global::System.Type)), false, reflectionInfoFactory: static () => 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()[1]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Type), "expectedEnumUnderlyingType", new global::TUnit.Core.ConcreteType(typeof(global::System.Type)), false, reflectionInfoFactory: static () => 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]) +}); + 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 __Invoke(global::TUnit.TestProject.ExpectedArgumentTypeTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(object), "value", new global::TUnit.Core.ConcreteType(typeof(object)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Type), "expectedValueType", new global::TUnit.Core.ConcreteType(typeof(global::System.Type)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Type), "expectedEnumUnderlyingType", new global::TUnit.Core.ConcreteType(typeof(global::System.Type)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.ByteEnum.Default, typeof(global::TUnit.TestProject.ByteEnum), typeof(byte)), - new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.SByteEnum.Default, typeof(global::TUnit.TestProject.SByteEnum), typeof(sbyte)), - new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.Int16Enum.Default, typeof(global::TUnit.TestProject.Int16Enum), typeof(short)), - new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.UInt16Enum.Default, typeof(global::TUnit.TestProject.UInt16Enum), typeof(ushort)), - new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.Int32Enum.Default, typeof(global::TUnit.TestProject.Int32Enum), typeof(int)), - new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.UInt32Enum.Default, typeof(global::TUnit.TestProject.UInt32Enum), typeof(uint)), - new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.Int64Enum.Default, typeof(global::TUnit.TestProject.Int64Enum), typeof(long)), - new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.UInt64Enum.Default, typeof(global::TUnit.TestProject.UInt64Enum), typeof(ulong)), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_TypedArguments__object_Type, metadata_EnumTypes__object_Type_Type }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.ExpectedArgumentTypeTests.TypedArguments", - ClassName = "ExpectedArgumentTypeTests", MethodName = "TypedArguments", FullyQualifiedName = "TUnit.TestProject.ExpectedArgumentTypeTests.TypedArguments", FilePath = @"", @@ -86,12 +109,31 @@ internal static class TUnit_TestProject_ExpectedArgumentTypeTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_TypedArguments__object_Type - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(0d, typeof(double)), + new global::TUnit.Core.ArgumentsAttribute(0f, typeof(float)), + new global::TUnit.Core.ArgumentsAttribute((sbyte)0, typeof(sbyte)), + new global::TUnit.Core.ArgumentsAttribute((byte)0, typeof(byte)), + new global::TUnit.Core.ArgumentsAttribute((short)0, typeof(short)), + new global::TUnit.Core.ArgumentsAttribute((ushort)0, typeof(ushort)), + new global::TUnit.Core.ArgumentsAttribute(0, typeof(int)), + new global::TUnit.Core.ArgumentsAttribute((uint)0, typeof(uint)), + new global::TUnit.Core.ArgumentsAttribute(0u, typeof(uint)), + new global::TUnit.Core.ArgumentsAttribute((long)0, typeof(long)), + new global::TUnit.Core.ArgumentsAttribute(0L, typeof(long)), + new global::TUnit.Core.ArgumentsAttribute((ulong)0, typeof(ulong)), + new global::TUnit.Core.ArgumentsAttribute(0UL, typeof(ulong)), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.ExpectedArgumentTypeTests.EnumTypes", - ClassName = "ExpectedArgumentTypeTests", MethodName = "EnumTypes", FullyQualifiedName = "TUnit.TestProject.ExpectedArgumentTypeTests.EnumTypes", FilePath = @"", @@ -101,141 +143,27 @@ internal static class TUnit_TestProject_ExpectedArgumentTypeTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_EnumTypes__object_Type_Type - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_TypedArguments__object_Type(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_EnumTypes__object_Type_Type(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_TypedArguments__object_Type(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ExpectedArgumentTypeTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.ExpectedArgumentTypeTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "TypedArguments", "TypedArguments", 8, - __InvokeTest_TypedArguments__object_Type, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("TypedArguments", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(object), "value", new global::TUnit.Core.ConcreteType(typeof(object)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Type), "expectedType", new global::TUnit.Core.ConcreteType(typeof(global::System.Type)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(0d, typeof(double)), - new global::TUnit.Core.ArgumentsAttribute(0f, typeof(float)), - new global::TUnit.Core.ArgumentsAttribute((sbyte)0, typeof(sbyte)), - new global::TUnit.Core.ArgumentsAttribute((byte)0, typeof(byte)), - new global::TUnit.Core.ArgumentsAttribute((short)0, typeof(short)), - new global::TUnit.Core.ArgumentsAttribute((ushort)0, typeof(ushort)), - new global::TUnit.Core.ArgumentsAttribute(0, typeof(int)), - new global::TUnit.Core.ArgumentsAttribute((uint)0, typeof(uint)), - new global::TUnit.Core.ArgumentsAttribute(0u, typeof(uint)), - new global::TUnit.Core.ArgumentsAttribute((long)0, typeof(long)), - new global::TUnit.Core.ArgumentsAttribute(0L, typeof(long)), - new global::TUnit.Core.ArgumentsAttribute((ulong)0, typeof(ulong)), - new global::TUnit.Core.ArgumentsAttribute(0UL, typeof(ulong)), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_EnumTypes__object_Type_Type(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ExpectedArgumentTypeTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.ExpectedArgumentTypeTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "EnumTypes", "EnumTypes", 25, - __InvokeTest_EnumTypes__object_Type_Type, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("EnumTypes", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(object), "value", new global::TUnit.Core.ConcreteType(typeof(object)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Type), "expectedValueType", new global::TUnit.Core.ConcreteType(typeof(global::System.Type)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Type), "expectedEnumUnderlyingType", new global::TUnit.Core.ConcreteType(typeof(global::System.Type)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.ByteEnum.Default, typeof(global::TUnit.TestProject.ByteEnum), typeof(byte)), - new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.SByteEnum.Default, typeof(global::TUnit.TestProject.SByteEnum), typeof(sbyte)), - new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.Int16Enum.Default, typeof(global::TUnit.TestProject.Int16Enum), typeof(short)), - new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.UInt16Enum.Default, typeof(global::TUnit.TestProject.UInt16Enum), typeof(ushort)), - new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.Int32Enum.Default, typeof(global::TUnit.TestProject.Int32Enum), typeof(int)), - new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.UInt32Enum.Default, typeof(global::TUnit.TestProject.UInt32Enum), typeof(uint)), - new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.Int64Enum.Default, typeof(global::TUnit.TestProject.Int64Enum), typeof(long)), - new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.UInt64Enum.Default, typeof(global::TUnit.TestProject.UInt64Enum), typeof(ulong)), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.ExpectedArgumentTypeTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.ExpectedArgumentTypeTests(); - } + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.ByteEnum.Default, typeof(global::TUnit.TestProject.ByteEnum), typeof(byte)), + new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.SByteEnum.Default, typeof(global::TUnit.TestProject.SByteEnum), typeof(sbyte)), + new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.Int16Enum.Default, typeof(global::TUnit.TestProject.Int16Enum), typeof(short)), + new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.UInt16Enum.Default, typeof(global::TUnit.TestProject.UInt16Enum), typeof(ushort)), + new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.Int32Enum.Default, typeof(global::TUnit.TestProject.Int32Enum), typeof(int)), + new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.UInt32Enum.Default, typeof(global::TUnit.TestProject.UInt32Enum), typeof(uint)), + new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.Int64Enum.Default, typeof(global::TUnit.TestProject.Int64Enum), typeof(long)), + new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.UInt64Enum.Default, typeof(global::TUnit.TestProject.UInt64Enum), typeof(ulong)), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_ExpectedArgumentTypeTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.ExpectedArgumentTypeTests), TUnit_TestProject_ExpectedArgumentTypeTests__TestSource.GetTests, TUnit_TestProject_ExpectedArgumentTypeTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_ExpectedArgumentTypeTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_ExpectedArgumentTypeTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/GenericMethodTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/GenericMethodTests.Test.verified.txt index 3282c7e988..d5f58a0762 100644 --- a/TUnit.Core.SourceGenerator.Tests/GenericMethodTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/GenericMethodTests.Test.verified.txt @@ -1,315 +1,146 @@ -// +// #pragma warning disable #nullable enable namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_GenericMethodTests_AggregateBy_HasExpectedOutput__IEnumerable_TSourc_06BD488B_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal static class TUnit_TestProject_GenericMethodTests_AggregateBy_HasExpectedOutput__IEnumerable_TSourc_06BD488B_TestSource { - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.GenericMethodTests", new global::TUnit.Core.ClassMetadata { - var __results = new global::System.Collections.Generic.List(); - // Create generic metadata with concrete type registrations - var genericMetadata = new global::TUnit.Core.GenericTestMetadata + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.GenericMethodTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("AggregateBy_HasExpectedOutput", __classType, typeof(void), __classMetadata, genericTypeCount: 3, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(object), "source", new global::TUnit.Core.ConstructedGeneric(typeof(global::System.Collections.Generic.IEnumerable<>), [new global::TUnit.Core.GenericParameter(0, true, "TSource")]), false, reflectionInfoFactory: static () => 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()[0]!), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(object), "keySelector", new global::TUnit.Core.ConstructedGeneric(typeof(global::System.Func<,>), [new global::TUnit.Core.GenericParameter(0, true, "TSource"), new global::TUnit.Core.GenericParameter(1, true, "TKey")]), false, reflectionInfoFactory: static () => 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()[1]!), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(object), "seedSelector", new global::TUnit.Core.ConstructedGeneric(typeof(global::System.Func<,>), [new global::TUnit.Core.GenericParameter(1, true, "TKey"), new global::TUnit.Core.GenericParameter(2, true, "TAccumulate")]), false, reflectionInfoFactory: static () => 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()[2]!), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(object), "func", new global::TUnit.Core.ConstructedGeneric(typeof(global::System.Func<,,>), [new global::TUnit.Core.GenericParameter(2, true, "TAccumulate"), new global::TUnit.Core.GenericParameter(0, true, "TSource"), new global::TUnit.Core.GenericParameter(2, true, "TAccumulate")]), false, reflectionInfoFactory: static () => 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()[3]!), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(object), "comparer", new global::TUnit.Core.ConstructedGeneric(typeof(global::System.Collections.Generic.IEqualityComparer<>), [new global::TUnit.Core.GenericParameter(1, true, "TKey")]), true, reflectionInfoFactory: static () => 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()[4]!), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(object), "expected", new global::TUnit.Core.ConstructedGeneric(typeof(global::System.Collections.Generic.IEnumerable<>), [new global::TUnit.Core.ConstructedGeneric(typeof(global::System.Collections.Generic.KeyValuePair<,>), [new global::TUnit.Core.GenericParameter(1, true, "TKey"), new global::TUnit.Core.GenericParameter(2, true, "TAccumulate")])]), false, reflectionInfoFactory: static () => 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]!) +}); + private static global::TUnit.TestProject.GenericMethodTests __CreateInstance_0(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.GenericMethodTests(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.GenericMethodTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - TestName = "AggregateBy_HasExpectedOutput", - TestClassType = typeof(global::TUnit.TestProject.GenericMethodTests), - TestMethodName = "AggregateBy_HasExpectedOutput", - Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - InheritanceDepth = 0, - FilePath = @"", - LineNumber = 8, - MethodMetadata = new global::TUnit.Core.MethodMetadata + case 0: { - Type = typeof(global::TUnit.TestProject.GenericMethodTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.GenericMethodTests)), - Name = "AggregateBy_HasExpectedOutput", - GenericTypeCount = 3, - ReturnType = typeof(void), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), - Parameters = new global::TUnit.Core.ParameterMetadata[] + try { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(object), "source", new global::TUnit.Core.ConstructedGeneric(typeof(global::System.Collections.Generic.IEnumerable<>), [new global::TUnit.Core.GenericParameter(0, true, "TSource")]), false, reflectionInfoFactory: static () => 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()[0]!), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(object), "keySelector", new global::TUnit.Core.ConstructedGeneric(typeof(global::System.Func<,>), [new global::TUnit.Core.GenericParameter(0, true, "TSource"), new global::TUnit.Core.GenericParameter(1, true, "TKey")]), false, reflectionInfoFactory: static () => 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()[1]!), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(object), "seedSelector", new global::TUnit.Core.ConstructedGeneric(typeof(global::System.Func<,>), [new global::TUnit.Core.GenericParameter(1, true, "TKey"), new global::TUnit.Core.GenericParameter(2, true, "TAccumulate")]), false, reflectionInfoFactory: static () => 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()[2]!), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(object), "func", new global::TUnit.Core.ConstructedGeneric(typeof(global::System.Func<,,>), [new global::TUnit.Core.GenericParameter(2, true, "TAccumulate"), new global::TUnit.Core.GenericParameter(0, true, "TSource"), new global::TUnit.Core.GenericParameter(2, true, "TAccumulate")]), false, reflectionInfoFactory: static () => 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()[3]!), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(object), "comparer", new global::TUnit.Core.ConstructedGeneric(typeof(global::System.Collections.Generic.IEqualityComparer<>), [new global::TUnit.Core.GenericParameter(1, true, "TKey")]), true, reflectionInfoFactory: static () => 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()[4]!), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(object), "expected", new global::TUnit.Core.ConstructedGeneric(typeof(global::System.Collections.Generic.IEnumerable<>), [new global::TUnit.Core.ConstructedGeneric(typeof(global::System.Collections.Generic.KeyValuePair<,>), [new global::TUnit.Core.GenericParameter(1, true, "TKey"), new global::TUnit.Core.GenericParameter(2, true, "TAccumulate")])]), false, reflectionInfoFactory: static () => 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", new global::TUnit.Core.ClassMetadata + instance.AggregateBy_HasExpectedOutput(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); + } + catch (global::System.Exception ex) { - 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) => + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + case 1: { - return new global::TUnit.TestProject.GenericMethodTests(); - }, - ConcreteInstantiations = new global::System.Collections.Generic.Dictionary + try + { + instance.AggregateBy_HasExpectedOutput(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); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + switch (groupIndex) + { + case 0: { - [(typeof(int).FullName ?? typeof(int).Name) + "," + (typeof(int).FullName ?? typeof(int).Name) + "," + (typeof(int).FullName ?? typeof(int).Name)] = - new global::TUnit.Core.TestMetadata + return new global::System.Attribute[] { - TestName = "AggregateBy_HasExpectedOutput", - TestClassType = typeof(global::TUnit.TestProject.GenericMethodTests), - TestMethodName = "AggregateBy_HasExpectedOutput", - GenericMethodTypeArguments = new global::System.Type[] { typeof(int), typeof(int), typeof(int)}, - Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.MethodDataSourceAttribute("AggregateBy_Numeric_TestData"), - new global::TUnit.Core.MethodDataSourceAttribute("AggregateBy_String_TestData"), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], - DataSources = new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("AggregateBy_Numeric_TestData") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.GenericMethodTests.AggregateBy_Numeric_TestData(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } - }, - new global::TUnit.Core.MethodDataSourceAttribute("AggregateBy_String_TestData") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.GenericMethodTests.AggregateBy_String_TestData(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } - }, - }, - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - FilePath = @"", - LineNumber = 8, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - Type = typeof(global::TUnit.TestProject.GenericMethodTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.GenericMethodTests)), - Name = "AggregateBy_HasExpectedOutput", - GenericTypeCount = 3, - ReturnType = typeof(void), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), - Parameters = new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(object), "source", new global::TUnit.Core.ConstructedGeneric(typeof(global::System.Collections.Generic.IEnumerable<>), [new global::TUnit.Core.GenericParameter(0, true, "TSource")]), false, reflectionInfoFactory: static () => 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()[0]!), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(object), "keySelector", new global::TUnit.Core.ConstructedGeneric(typeof(global::System.Func<,>), [new global::TUnit.Core.GenericParameter(0, true, "TSource"), new global::TUnit.Core.GenericParameter(1, true, "TKey")]), false, reflectionInfoFactory: static () => 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()[1]!), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(object), "seedSelector", new global::TUnit.Core.ConstructedGeneric(typeof(global::System.Func<,>), [new global::TUnit.Core.GenericParameter(1, true, "TKey"), new global::TUnit.Core.GenericParameter(2, true, "TAccumulate")]), false, reflectionInfoFactory: static () => 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()[2]!), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(object), "func", new global::TUnit.Core.ConstructedGeneric(typeof(global::System.Func<,,>), [new global::TUnit.Core.GenericParameter(2, true, "TAccumulate"), new global::TUnit.Core.GenericParameter(0, true, "TSource"), new global::TUnit.Core.GenericParameter(2, true, "TAccumulate")]), false, reflectionInfoFactory: static () => 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()[3]!), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(object), "comparer", new global::TUnit.Core.ConstructedGeneric(typeof(global::System.Collections.Generic.IEqualityComparer<>), [new global::TUnit.Core.GenericParameter(1, true, "TKey")]), true, reflectionInfoFactory: static () => 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()[4]!), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(object), "expected", new global::TUnit.Core.ConstructedGeneric(typeof(global::System.Collections.Generic.IEnumerable<>), [new global::TUnit.Core.ConstructedGeneric(typeof(global::System.Collections.Generic.KeyValuePair<,>), [new global::TUnit.Core.GenericParameter(1, true, "TKey"), new global::TUnit.Core.GenericParameter(2, true, "TAccumulate")])]), false, reflectionInfoFactory: static () => 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", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.GenericMethodTests(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.MethodDataSourceAttribute("AggregateBy_Numeric_TestData"), + new global::TUnit.Core.MethodDataSourceAttribute("AggregateBy_String_TestData"), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + }; + } + case 1: + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.MethodDataSourceAttribute("AggregateBy_Numeric_TestData"), + new global::TUnit.Core.MethodDataSourceAttribute("AggregateBy_String_TestData"), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + }; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } + } + public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry + { + MethodName = "AggregateBy_HasExpectedOutput", + FullyQualifiedName = "TUnit.TestProject.GenericMethodTests.AggregateBy_HasExpectedOutput", + FilePath = @"", + LineNumber = 8, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("AggregateBy_Numeric_TestData") + { + Factory = (dataGeneratorMetadata) => + { + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + { + var result = global::TUnit.TestProject.GenericMethodTests.AggregateBy_Numeric_TestData(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) + { + foreach (var item in enumerable) { - try - { - var typedInstance = (global::TUnit.TestProject.GenericMethodTests)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.AggregateBy_HasExpectedOutput((global::System.Collections.Generic.IEnumerable)args[0]!, (global::System.Func)args[1]!, (global::System.Func)args[2]!, (global::System.Func)args[3]!, (global::System.Collections.Generic.IEqualityComparer)args[4]!, (global::System.Collections.Generic.IEnumerable>)args[5]!)); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); } } - , - [(typeof(string).FullName ?? typeof(string).Name) + "," + (typeof(string).FullName ?? typeof(string).Name) + "," + (typeof(string).FullName ?? typeof(string).Name)] = - new global::TUnit.Core.TestMetadata + else { - TestName = "AggregateBy_HasExpectedOutput", - TestClassType = typeof(global::TUnit.TestProject.GenericMethodTests), - TestMethodName = "AggregateBy_HasExpectedOutput", - GenericMethodTypeArguments = new global::System.Type[] { typeof(string), typeof(string), typeof(string)}, - Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.MethodDataSourceAttribute("AggregateBy_Numeric_TestData"), - new global::TUnit.Core.MethodDataSourceAttribute("AggregateBy_String_TestData"), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], - DataSources = new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("AggregateBy_Numeric_TestData") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.GenericMethodTests.AggregateBy_Numeric_TestData(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } - }, - new global::TUnit.Core.MethodDataSourceAttribute("AggregateBy_String_TestData") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.GenericMethodTests.AggregateBy_String_TestData(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } - }, - }, - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - FilePath = @"", - LineNumber = 8, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - Type = typeof(global::TUnit.TestProject.GenericMethodTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.GenericMethodTests)), - Name = "AggregateBy_HasExpectedOutput", - GenericTypeCount = 3, - ReturnType = typeof(void), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), - Parameters = new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(object), "source", new global::TUnit.Core.ConstructedGeneric(typeof(global::System.Collections.Generic.IEnumerable<>), [new global::TUnit.Core.GenericParameter(0, true, "TSource")]), false, reflectionInfoFactory: static () => 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()[0]!), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(object), "keySelector", new global::TUnit.Core.ConstructedGeneric(typeof(global::System.Func<,>), [new global::TUnit.Core.GenericParameter(0, true, "TSource"), new global::TUnit.Core.GenericParameter(1, true, "TKey")]), false, reflectionInfoFactory: static () => 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()[1]!), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(object), "seedSelector", new global::TUnit.Core.ConstructedGeneric(typeof(global::System.Func<,>), [new global::TUnit.Core.GenericParameter(1, true, "TKey"), new global::TUnit.Core.GenericParameter(2, true, "TAccumulate")]), false, reflectionInfoFactory: static () => 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()[2]!), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(object), "func", new global::TUnit.Core.ConstructedGeneric(typeof(global::System.Func<,,>), [new global::TUnit.Core.GenericParameter(2, true, "TAccumulate"), new global::TUnit.Core.GenericParameter(0, true, "TSource"), new global::TUnit.Core.GenericParameter(2, true, "TAccumulate")]), false, reflectionInfoFactory: static () => 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()[3]!), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(object), "comparer", new global::TUnit.Core.ConstructedGeneric(typeof(global::System.Collections.Generic.IEqualityComparer<>), [new global::TUnit.Core.GenericParameter(1, true, "TKey")]), true, reflectionInfoFactory: static () => 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()[4]!), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(object), "expected", new global::TUnit.Core.ConstructedGeneric(typeof(global::System.Collections.Generic.IEnumerable<>), [new global::TUnit.Core.ConstructedGeneric(typeof(global::System.Collections.Generic.KeyValuePair<,>), [new global::TUnit.Core.GenericParameter(1, true, "TKey"), new global::TUnit.Core.GenericParameter(2, true, "TAccumulate")])]), false, reflectionInfoFactory: static () => 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", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.GenericMethodTests(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var typedInstance = (global::TUnit.TestProject.GenericMethodTests)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.AggregateBy_HasExpectedOutput((global::System.Collections.Generic.IEnumerable)args[0]!, (global::System.Func)args[1]!, (global::System.Func)args[2]!, (global::System.Func)args[3]!, (global::System.Collections.Generic.IEqualityComparer)args[4]!, (global::System.Collections.Generic.IEnumerable>)args[5]!)); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } - , } - }; - genericMetadata.TestSessionId = testSessionId; - __results.Add(genericMetadata); - return __results; - } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor + return Factory(); + } + }, +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.GenericMethodTests.AggregateBy_HasExpectedOutput", - ClassName = "GenericMethodTests", - MethodName = "AggregateBy_HasExpectedOutput", - FullyQualifiedName = "TUnit.TestProject.GenericMethodTests.AggregateBy_HasExpectedOutput", + MethodName = "AggregateBy_HasExpectedOutput", + FullyQualifiedName = "TUnit.TestProject.GenericMethodTests.AggregateBy_HasExpectedOutput", FilePath = @"", LineNumber = 8, Categories = global::System.Array.Empty(), @@ -317,11 +148,41 @@ internal sealed class TUnit_TestProject_GenericMethodTests_AggregateBy_HasExpect HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 1, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 1, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("AggregateBy_String_TestData") + { + Factory = (dataGeneratorMetadata) => + { + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + { + var result = global::TUnit.TestProject.GenericMethodTests.AggregateBy_String_TestData(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) + { + foreach (var item in enumerable) + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + } + } + else + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } + } + return Factory(); + } + }, +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_GenericMethodTests_AggregateBy_HasExpectedOutput__IEnumerable_TSourc_06BD488B_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.GenericMethodTests), new TUnit_TestProject_GenericMethodTests_AggregateBy_HasExpectedOutput__IEnumerable_TSourc_06BD488B_TestSource()); + static readonly int _r_TUnit_TestProject_GenericMethodTests_AggregateBy_HasExpectedOutput__IEnumerable_TSourc_06BD488B_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_GenericMethodTests_AggregateBy_HasExpectedOutput__IEnumerable_TSourc_06BD488B_TestSource.Entries_0); } 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 dadfa9c589..9a023181c1 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,205 +1,56 @@ -// +// #pragma warning disable #nullable enable namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_Bugs__4431_GenericClassNoDataSource_T_Should_Create_Instance_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal static class TUnit_TestProject_Bugs__4431_GenericClassNoDataSource_T_Should_Create_Instance_TestSource { - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var __results = new global::System.Collections.Generic.List(); - // Create generic metadata with concrete type registrations - var genericMetadata = new global::TUnit.Core.GenericTestMetadata - { - TestName = "Should_Create_Instance", - TestClassType = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassNoDataSource<>), - TestMethodName = "Should_Create_Instance", - 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.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - InheritanceDepth = 0, - FilePath = @"", - LineNumber = 35, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - 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 = "Should_Create_Instance", - GenericTypeCount = 0, - 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<>", 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) => - { - var genericType = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassNoDataSource<>); - if (typeArgs.Length > 0) - { - var closedType = genericType.MakeGenericType(typeArgs); - return global::System.Activator.CreateInstance(closedType, args)!; - } - throw new global::System.InvalidOperationException("No type arguments provided for generic class"); - }, - ConcreteInstantiations = new global::System.Collections.Generic.Dictionary - { - [(typeof(global::TUnit.TestProject.Bugs._4431.TypeA).FullName ?? typeof(global::TUnit.TestProject.Bugs._4431.TypeA).Name)] = - new global::TUnit.Core.TestMetadata> - { - TestName = "Should_Create_Instance", - TestClassType = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassNoDataSource), - TestMethodName = "Should_Create_Instance", - 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.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - FilePath = @"", - LineNumber = 35, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - 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 = "Should_Create_Instance", - GenericTypeCount = 0, - 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<>", 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) => - { - return new global::TUnit.TestProject.Bugs._4431.GenericClassNoDataSource(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var typedInstance = (global::TUnit.TestProject.Bugs._4431.GenericClassNoDataSource)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.Should_Create_Instance()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - } - , - [(typeof(global::TUnit.TestProject.Bugs._4431.TypeB).FullName ?? typeof(global::TUnit.TestProject.Bugs._4431.TypeB).Name)] = - new global::TUnit.Core.TestMetadata> - { - TestName = "Should_Create_Instance", - TestClassType = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassNoDataSource), - TestMethodName = "Should_Create_Instance", - 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.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - FilePath = @"", - LineNumber = 35, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - 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 = "Should_Create_Instance", - GenericTypeCount = 0, - 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<>", 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) => - { - return new global::TUnit.TestProject.Bugs._4431.GenericClassNoDataSource(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var typedInstance = (global::TUnit.TestProject.Bugs._4431.GenericClassNoDataSource)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.Should_Create_Instance()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - } - , - } + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassNoDataSource<>); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Should_Create_Instance", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static global::TUnit.TestProject.Bugs._4431.GenericClassNoDataSource __CreateInstance_0(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._4431.GenericClassNoDataSource(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.Bugs._4431.GenericClassNoDataSource instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.Should_Create_Instance()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) }; - genericMetadata.TestSessionId = testSessionId; - __results.Add(genericMetadata); - return __results; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry>[] Entries_0 = new global::TUnit.Core.TestEntry>[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry> { - TestId = "TUnit.TestProject.Bugs._4431.GenericClassNoDataSource.Should_Create_Instance", - ClassName = "GenericClassNoDataSource", MethodName = "Should_Create_Instance", - FullyQualifiedName = "TUnit.TestProject.Bugs._4431.GenericClassNoDataSource.Should_Create_Instance", + FullyQualifiedName = "TUnit.TestProject.Bugs._4431.GenericClassNoDataSource.Should_Create_Instance", FilePath = @"", LineNumber = 35, Categories = global::System.Array.Empty(), @@ -207,13 +58,68 @@ internal sealed class TUnit_TestProject_Bugs__4431_GenericClassNoDataSource_T_Sh HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + }, + }; + private static global::TUnit.TestProject.Bugs._4431.GenericClassNoDataSource __CreateInstance_1(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._4431.GenericClassNoDataSource(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke_1(global::TUnit.TestProject.Bugs._4431.GenericClassNoDataSource instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.Should_Create_Instance()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + private static global::System.Attribute[] __Attributes_1(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) }; } + public static readonly global::TUnit.Core.TestEntry>[] Entries_1 = new global::TUnit.Core.TestEntry>[] + { + new global::TUnit.Core.TestEntry> + { + MethodName = "Should_Create_Instance", + FullyQualifiedName = "TUnit.TestProject.Bugs._4431.GenericClassNoDataSource.Should_Create_Instance", + FilePath = @"", + LineNumber = 35, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_1, + InvokeBody = __Invoke_1, + MethodIndex = 0, + CreateAttributes = __Attributes_1, + AttributeGroupIndex = 0, + }, + }; +} +internal static partial class TUnit_TestRegistration +{ + static readonly int _r_TUnit_TestProject_Bugs__4431_GenericClassNoDataSource_T_Should_Create_Instance_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__4431_GenericClassNoDataSource_T_Should_Create_Instance_TestSource.Entries_0); } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__4431_GenericClassNoDataSource_T_Should_Create_Instance_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassNoDataSource<>), new TUnit_TestProject_Bugs__4431_GenericClassNoDataSource_T_Should_Create_Instance_TestSource()); + static readonly int _r_TUnit_TestProject_Bugs__4431_GenericClassNoDataSource_T_Should_Create_Instance_TestSource_1 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__4431_GenericClassNoDataSource_T_Should_Create_Instance_TestSource.Entries_1); } @@ -226,260 +132,128 @@ internal static partial class TUnit_TestRegistration namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_Bugs__4431_GenericClassWithMethodDataSource_T_Should_Have_Number__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal static class TUnit_TestProject_Bugs__4431_GenericClassWithMethodDataSource_T_Should_Have_Number__int_TestSource +{ + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource<>); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Should_Have_Number", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] { - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var __results = new global::System.Collections.Generic.List(); - // Create generic metadata with concrete type registrations - var genericMetadata = new global::TUnit.Core.GenericTestMetadata - { - TestName = "Should_Have_Number", - TestClassType = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource<>), - TestMethodName = "Should_Have_Number", - 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.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - InheritanceDepth = 0, +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "number", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource __CreateInstance_0(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.Should_Have_Number(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.MethodDataSourceAttribute("GetNumbers"), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) + }; + } + public static readonly global::TUnit.Core.TestEntry>[] Entries_0 = new global::TUnit.Core.TestEntry>[] + { + new global::TUnit.Core.TestEntry> + { + MethodName = "Should_Have_Number", + FullyQualifiedName = "TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource.Should_Have_Number", FilePath = @"", LineNumber = 59, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - 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 = "Should_Have_Number", - GenericTypeCount = 0, - ReturnType = typeof(global::System.Threading.Tasks.Task), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), - Parameters = new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "number", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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<>", 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) => - { - var genericType = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource<>); - if (typeArgs.Length > 0) - { - var closedType = genericType.MakeGenericType(typeArgs); - return global::System.Activator.CreateInstance(closedType, args)!; - } - throw new global::System.InvalidOperationException("No type arguments provided for generic class"); - }, - ConcreteInstantiations = new global::System.Collections.Generic.Dictionary + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("GetNumbers") + { + Factory = (dataGeneratorMetadata) => + { + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - [(typeof(global::TUnit.TestProject.Bugs._4431.TypeA).FullName ?? typeof(global::TUnit.TestProject.Bugs._4431.TypeA).Name)] = - new global::TUnit.Core.TestMetadata> + var result = global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource.GetNumbers(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) { - TestName = "Should_Have_Number", - TestClassType = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource), - TestMethodName = "Should_Have_Number", - 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("GetNumbers"), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) - ], - DataSources = new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("GetNumbers") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource.GetNumbers(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } - }, - }, - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - FilePath = @"", - LineNumber = 59, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - 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 = "Should_Have_Number", - GenericTypeCount = 0, - ReturnType = typeof(global::System.Threading.Tasks.Task), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), - Parameters = new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "number", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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<>", 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) => - { - return new global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => + foreach (var item in enumerable) { - try - { - var typedInstance = (global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.Should_Have_Number((int)args[0]!)); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); } } - , - [(typeof(global::TUnit.TestProject.Bugs._4431.TypeB).FullName ?? typeof(global::TUnit.TestProject.Bugs._4431.TypeB).Name)] = - new global::TUnit.Core.TestMetadata> + else { - TestName = "Should_Have_Number", - TestClassType = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource), - TestMethodName = "Should_Have_Number", - 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("GetNumbers"), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) - ], - DataSources = new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("GetNumbers") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource.GetNumbers(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } - }, - }, - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - FilePath = @"", - LineNumber = 59, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - 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 = "Should_Have_Number", - GenericTypeCount = 0, - ReturnType = typeof(global::System.Threading.Tasks.Task), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), - Parameters = new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "number", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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<>", 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) => - { - return new global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var typedInstance = (global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.Should_Have_Number((int)args[0]!)); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } - , } + return Factory(); + } + }, +}, + }, + }; + private static global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource __CreateInstance_1(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke_1(global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.Should_Have_Number(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + private static global::System.Attribute[] __Attributes_1(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.MethodDataSourceAttribute("GetNumbers"), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) }; - genericMetadata.TestSessionId = testSessionId; - __results.Add(genericMetadata); - return __results; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry>[] Entries_1 = new global::TUnit.Core.TestEntry>[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry> { - TestId = "TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource.Should_Have_Number", - ClassName = "GenericClassWithMethodDataSource", MethodName = "Should_Have_Number", - FullyQualifiedName = "TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource.Should_Have_Number", + FullyQualifiedName = "TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource.Should_Have_Number", FilePath = @"", LineNumber = 59, Categories = global::System.Array.Empty(), @@ -487,13 +261,47 @@ internal sealed class TUnit_TestProject_Bugs__4431_GenericClassWithMethodDataSou HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_1, + InvokeBody = __Invoke_1, + MethodIndex = 0, + CreateAttributes = __Attributes_1, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("GetNumbers") + { + Factory = (dataGeneratorMetadata) => + { + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + { + var result = global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource.GetNumbers(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) + { + foreach (var item in enumerable) + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + } + } + else + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } + } + return Factory(); + } + }, +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__4431_GenericClassWithMethodDataSource_T_Should_Have_Number__int_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithMethodDataSource<>), new TUnit_TestProject_Bugs__4431_GenericClassWithMethodDataSource_T_Should_Have_Number__int_TestSource()); + static readonly int _r_TUnit_TestProject_Bugs__4431_GenericClassWithMethodDataSource_T_Should_Have_Number__int_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__4431_GenericClassWithMethodDataSource_T_Should_Have_Number__int_TestSource.Entries_0); +} +internal static partial class TUnit_TestRegistration +{ + static readonly int _r_TUnit_TestProject_Bugs__4431_GenericClassWithMethodDataSource_T_Should_Have_Number__int_TestSource_1 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__4431_GenericClassWithMethodDataSource_T_Should_Have_Number__int_TestSource.Entries_1); } @@ -506,263 +314,113 @@ internal static partial class TUnit_TestRegistration namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_Bugs__4431_NonGenericClassWithGenericMethod_GenericMethod_Should_Work_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal static class TUnit_TestProject_Bugs__4431_NonGenericClassWithGenericMethod_GenericMethod_Should_Work_TestSource { - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var __results = new global::System.Collections.Generic.List(); - // Create generic metadata with concrete type registrations - var genericMetadata = new global::TUnit.Core.GenericTestMetadata - { - TestName = "GenericMethod_Should_Work", - TestClassType = typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod), - TestMethodName = "GenericMethod_Should_Work", - 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.GenerateGenericTestAttribute(typeof(int)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(string)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)) - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - InheritanceDepth = 0, - FilePath = @"", - LineNumber = 74, - MethodMetadata = new global::TUnit.Core.MethodMetadata + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("GenericMethod_Should_Work", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, genericTypeCount: 1); + private static global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod __CreateInstance_0(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) + { + case 0: { - Type = typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod)), - Name = "GenericMethod_Should_Work", - GenericTypeCount = 1, - 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", new global::TUnit.Core.ClassMetadata + try { - 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) => - { - return new global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod(); - }, - ConcreteInstantiations = new global::System.Collections.Generic.Dictionary + return new global::System.Threading.Tasks.ValueTask(instance.GenericMethod_Should_Work()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + case 1: { - [(typeof(int).FullName ?? typeof(int).Name)] = - new global::TUnit.Core.TestMetadata + try { - TestName = "GenericMethod_Should_Work", - TestClassType = typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod), - TestMethodName = "GenericMethod_Should_Work", - GenericMethodTypeArguments = new global::System.Type[] { typeof(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), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(int)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(string)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)) - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - FilePath = @"", - LineNumber = 74, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod)), - Name = "GenericMethod_Should_Work", - GenericTypeCount = 1, - 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", 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) => - { - return new global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var typedInstance = (global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.GenericMethod_Should_Work()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } + return new global::System.Threading.Tasks.ValueTask(instance.GenericMethod_Should_Work()); } - , - [(typeof(string).FullName ?? typeof(string).Name)] = - new global::TUnit.Core.TestMetadata + catch (global::System.Exception ex) { - TestName = "GenericMethod_Should_Work", - TestClassType = typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod), - TestMethodName = "GenericMethod_Should_Work", - GenericMethodTypeArguments = new global::System.Type[] { typeof(string)}, - 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.GenerateGenericTestAttribute(typeof(int)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(string)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)) - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - FilePath = @"", - LineNumber = 74, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod)), - Name = "GenericMethod_Should_Work", - GenericTypeCount = 1, - 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", 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) => - { - return new global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var typedInstance = (global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.GenericMethod_Should_Work()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + case 2: + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.GenericMethod_Should_Work()); } - , - [(typeof(global::TUnit.TestProject.Bugs._4431.TypeA).FullName ?? typeof(global::TUnit.TestProject.Bugs._4431.TypeA).Name)] = - new global::TUnit.Core.TestMetadata + catch (global::System.Exception ex) { - TestName = "GenericMethod_Should_Work", - TestClassType = typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod), - TestMethodName = "GenericMethod_Should_Work", - GenericMethodTypeArguments = new global::System.Type[] { typeof(global::TUnit.TestProject.Bugs._4431.TypeA)}, - 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.GenerateGenericTestAttribute(typeof(int)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(string)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)) - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - FilePath = @"", - LineNumber = 74, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod)), - Name = "GenericMethod_Should_Work", - GenericTypeCount = 1, - 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", 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) => - { - return new global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var typedInstance = (global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.GenericMethod_Should_Work()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } - , } - }; - genericMetadata.TestSessionId = testSessionId; - __results.Add(genericMetadata); - return __results; + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + switch (groupIndex) + { + case 0: + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(int)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(string)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)) + }; + } + case 1: + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(int)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(string)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)) + }; + } + case 2: + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(int)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(string)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)) + }; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod.GenericMethod_Should_Work", - ClassName = "NonGenericClassWithGenericMethod", - MethodName = "GenericMethod_Should_Work", - FullyQualifiedName = "TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod.GenericMethod_Should_Work", + MethodName = "GenericMethod_Should_Work", + FullyQualifiedName = "TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod.GenericMethod_Should_Work", FilePath = @"", LineNumber = 74, Categories = global::System.Array.Empty(), @@ -770,13 +428,54 @@ internal sealed class TUnit_TestProject_Bugs__4431_NonGenericClassWithGenericMet HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry + { + MethodName = "GenericMethod_Should_Work", + FullyQualifiedName = "TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod.GenericMethod_Should_Work", + FilePath = @"", + LineNumber = 74, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 1, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 1, + }, + new global::TUnit.Core.TestEntry + { + MethodName = "GenericMethod_Should_Work", + FullyQualifiedName = "TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod.GenericMethod_Should_Work", + FilePath = @"", + LineNumber = 74, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 2, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 2, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__4431_NonGenericClassWithGenericMethod_GenericMethod_Should_Work_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethod), new TUnit_TestProject_Bugs__4431_NonGenericClassWithGenericMethod_GenericMethod_Should_Work_TestSource()); + static readonly int _r_TUnit_TestProject_Bugs__4431_NonGenericClassWithGenericMethod_GenericMethod_Should_Work_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__4431_NonGenericClassWithGenericMethod_GenericMethod_Should_Work_TestSource.Entries_0); } @@ -789,256 +488,94 @@ internal static partial class TUnit_TestRegistration namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_Bugs__4431_NonGenericClassWithGenericMethodAndDataSource_GenericMeth_0AB5EDCD_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal static class TUnit_TestProject_Bugs__4431_NonGenericClassWithGenericMethodAndDataSource_GenericMeth_0AB5EDCD_TestSource { - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var __results = new global::System.Collections.Generic.List(); - // Create generic metadata with concrete type registrations - var genericMetadata = new global::TUnit.Core.GenericTestMetadata - { - TestName = "GenericMethod_With_DataSource", - TestClassType = typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource), - TestMethodName = "GenericMethod_With_DataSource", - 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.GenerateGenericTestAttribute(typeof(int)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(double)) - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - InheritanceDepth = 0, - FilePath = @"", - LineNumber = 97, - MethodMetadata = new global::TUnit.Core.MethodMetadata + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("GenericMethod_With_DataSource", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, genericTypeCount: 1, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "input", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]!) +}); + private static global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource __CreateInstance_0(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) + { + case 0: { - Type = typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource)), - Name = "GenericMethod_With_DataSource", - GenericTypeCount = 1, - ReturnType = typeof(global::System.Threading.Tasks.Task), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), - Parameters = new global::TUnit.Core.ParameterMetadata[] + try { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "input", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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", new global::TUnit.Core.ClassMetadata + return new global::System.Threading.Tasks.ValueTask(instance.GenericMethod_With_DataSource(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + catch (global::System.Exception ex) { - 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) => - { - return new global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource(); - }, - ConcreteInstantiations = new global::System.Collections.Generic.Dictionary + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + case 1: { - [(typeof(int).FullName ?? typeof(int).Name)] = - new global::TUnit.Core.TestMetadata + try { - TestName = "GenericMethod_With_DataSource", - TestClassType = typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource), - TestMethodName = "GenericMethod_With_DataSource", - GenericMethodTypeArguments = new global::System.Type[] { typeof(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), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(int)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(double)), - new global::TUnit.Core.MethodDataSourceAttribute("GetStrings") - ], - DataSources = new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("GetStrings") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource.GetStrings(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } - }, - }, - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - FilePath = @"", - LineNumber = 97, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource)), - Name = "GenericMethod_With_DataSource", - GenericTypeCount = 1, - ReturnType = typeof(global::System.Threading.Tasks.Task), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), - Parameters = new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "input", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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", 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) => - { - return new global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var typedInstance = (global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.GenericMethod_With_DataSource((string)args[0]!)); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } + return new global::System.Threading.Tasks.ValueTask(instance.GenericMethod_With_DataSource(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); } - , - [(typeof(double).FullName ?? typeof(double).Name)] = - new global::TUnit.Core.TestMetadata + catch (global::System.Exception ex) { - TestName = "GenericMethod_With_DataSource", - TestClassType = typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource), - TestMethodName = "GenericMethod_With_DataSource", - GenericMethodTypeArguments = new global::System.Type[] { typeof(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), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(int)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(double)), - new global::TUnit.Core.MethodDataSourceAttribute("GetStrings") - ], - DataSources = new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("GetStrings") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource.GetStrings(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } - }, - }, - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - FilePath = @"", - LineNumber = 97, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource)), - Name = "GenericMethod_With_DataSource", - GenericTypeCount = 1, - ReturnType = typeof(global::System.Threading.Tasks.Task), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), - Parameters = new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "input", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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", 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) => - { - return new global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var typedInstance = (global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.GenericMethod_With_DataSource((string)args[0]!)); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } - , } - }; - genericMetadata.TestSessionId = testSessionId; - __results.Add(genericMetadata); - return __results; + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + switch (groupIndex) + { + case 0: + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(int)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(double)), + new global::TUnit.Core.MethodDataSourceAttribute("GetStrings") + }; + } + case 1: + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(int)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(double)), + new global::TUnit.Core.MethodDataSourceAttribute("GetStrings") + }; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource.GenericMethod_With_DataSource", - ClassName = "NonGenericClassWithGenericMethodAndDataSource", - MethodName = "GenericMethod_With_DataSource", - FullyQualifiedName = "TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource.GenericMethod_With_DataSource", + MethodName = "GenericMethod_With_DataSource", + FullyQualifiedName = "TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource.GenericMethod_With_DataSource", FilePath = @"", LineNumber = 97, Categories = global::System.Array.Empty(), @@ -1046,356 +583,185 @@ internal sealed class TUnit_TestProject_Bugs__4431_NonGenericClassWithGenericMet HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } -} -internal static partial class TUnit_TestRegistration -{ - static readonly int _r_TUnit_TestProject_Bugs__4431_NonGenericClassWithGenericMethodAndDataSource_GenericMeth_0AB5EDCD_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource), new TUnit_TestProject_Bugs__4431_NonGenericClassWithGenericMethodAndDataSource_GenericMeth_0AB5EDCD_TestSource()); -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_Bugs__4431_GenericClassWithGenericMethod_TClass_BothGeneric_Should_Work_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] { - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var __results = new global::System.Collections.Generic.List(); - // Create generic metadata with concrete type registrations - var genericMetadata = new global::TUnit.Core.GenericTestMetadata - { - TestName = "BothGeneric_Should_Work", - TestClassType = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod<>), - TestMethodName = "BothGeneric_Should_Work", - 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.GenerateGenericTestAttribute(typeof(int)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(string)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - InheritanceDepth = 0, - FilePath = @"", - LineNumber = 117, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - 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 = "BothGeneric_Should_Work", - GenericTypeCount = 1, - 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<>", 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) => + new global::TUnit.Core.MethodDataSourceAttribute("GetStrings") + { + Factory = (dataGeneratorMetadata) => + { + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - var genericType = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod<>); - if (typeArgs.Length > 0) + var result = global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource.GetStrings(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) { - var closedType = genericType.MakeGenericType(typeArgs); - return global::System.Activator.CreateInstance(closedType, args)!; + foreach (var item in enumerable) + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + } } - throw new global::System.InvalidOperationException("No type arguments provided for generic class"); - }, - ConcreteInstantiations = new global::System.Collections.Generic.Dictionary - { - [(typeof(global::TUnit.TestProject.Bugs._4431.TypeA).FullName ?? typeof(global::TUnit.TestProject.Bugs._4431.TypeA).Name) + "," + (typeof(int).FullName ?? typeof(int).Name)] = - new global::TUnit.Core.TestMetadata> + else { - TestName = "BothGeneric_Should_Work", - TestClassType = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod), - TestMethodName = "BothGeneric_Should_Work", - GenericMethodTypeArguments = new global::System.Type[] { typeof(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), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(int)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(string)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - FilePath = @"", - LineNumber = 117, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - 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 = "BothGeneric_Should_Work", - GenericTypeCount = 1, - 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<>", 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) => - { - return new global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var typedInstance = (global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.BothGeneric_Should_Work()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } - , - [(typeof(global::TUnit.TestProject.Bugs._4431.TypeA).FullName ?? typeof(global::TUnit.TestProject.Bugs._4431.TypeA).Name) + "," + (typeof(string).FullName ?? typeof(string).Name)] = - new global::TUnit.Core.TestMetadata> + } + return Factory(); + } + }, +}, + }, + new global::TUnit.Core.TestEntry + { + MethodName = "GenericMethod_With_DataSource", + FullyQualifiedName = "TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource.GenericMethod_With_DataSource", + FilePath = @"", + LineNumber = 97, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 1, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 1, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("GetStrings") + { + Factory = (dataGeneratorMetadata) => + { + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + { + var result = global::TUnit.TestProject.Bugs._4431.NonGenericClassWithGenericMethodAndDataSource.GetStrings(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) { - TestName = "BothGeneric_Should_Work", - TestClassType = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod), - TestMethodName = "BothGeneric_Should_Work", - GenericMethodTypeArguments = new global::System.Type[] { typeof(string)}, - 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.GenerateGenericTestAttribute(typeof(int)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(string)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - FilePath = @"", - LineNumber = 117, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - 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 = "BothGeneric_Should_Work", - GenericTypeCount = 1, - 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<>", 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) => + foreach (var item in enumerable) { - return new global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var typedInstance = (global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.BothGeneric_Should_Work()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); } } - , - [(typeof(global::TUnit.TestProject.Bugs._4431.TypeB).FullName ?? typeof(global::TUnit.TestProject.Bugs._4431.TypeB).Name) + "," + (typeof(int).FullName ?? typeof(int).Name)] = - new global::TUnit.Core.TestMetadata> + else { - TestName = "BothGeneric_Should_Work", - TestClassType = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod), - TestMethodName = "BothGeneric_Should_Work", - GenericMethodTypeArguments = new global::System.Type[] { typeof(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), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(int)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(string)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - FilePath = @"", - LineNumber = 117, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - 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 = "BothGeneric_Should_Work", - GenericTypeCount = 1, - 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<>", 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) => - { - return new global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var typedInstance = (global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.BothGeneric_Should_Work()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } + } + return Factory(); + } + }, +}, + }, + }; +} +internal static partial class TUnit_TestRegistration +{ + static readonly int _r_TUnit_TestProject_Bugs__4431_NonGenericClassWithGenericMethodAndDataSource_GenericMeth_0AB5EDCD_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__4431_NonGenericClassWithGenericMethodAndDataSource_GenericMeth_0AB5EDCD_TestSource.Entries_0); +} + + +// ===== FILE SEPARATOR ===== + +// +#pragma warning disable + +#nullable enable +namespace TUnit.Generated; +[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] +[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] +internal static class TUnit_TestProject_Bugs__4431_GenericClassWithGenericMethod_TClass_BothGeneric_Should_Work_TestSource +{ + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod<>); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("BothGeneric_Should_Work", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, genericTypeCount: 1); + private static global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod __CreateInstance_0(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) + { + case 0: + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.BothGeneric_Should_Work()); } - , - [(typeof(global::TUnit.TestProject.Bugs._4431.TypeB).FullName ?? typeof(global::TUnit.TestProject.Bugs._4431.TypeB).Name) + "," + (typeof(string).FullName ?? typeof(string).Name)] = - new global::TUnit.Core.TestMetadata> + catch (global::System.Exception ex) { - TestName = "BothGeneric_Should_Work", - TestClassType = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod), - TestMethodName = "BothGeneric_Should_Work", - GenericMethodTypeArguments = new global::System.Type[] { typeof(string)}, - 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.GenerateGenericTestAttribute(typeof(int)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(string)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - FilePath = @"", - LineNumber = 117, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - 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 = "BothGeneric_Should_Work", - GenericTypeCount = 1, - 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<>", 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) => - { - return new global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var typedInstance = (global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.BothGeneric_Should_Work()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } - , } - }; - genericMetadata.TestSessionId = testSessionId; - __results.Add(genericMetadata); - return __results; + case 1: + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.BothGeneric_Should_Work()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + switch (groupIndex) + { + case 0: + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(int)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(string)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) + }; + } + case 1: + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(int)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(string)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) + }; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry>[] Entries_0 = new global::TUnit.Core.TestEntry>[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry> { - TestId = "TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod.BothGeneric_Should_Work", - ClassName = "GenericClassWithGenericMethod", - MethodName = "BothGeneric_Should_Work", - FullyQualifiedName = "TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod.BothGeneric_Should_Work", + MethodName = "BothGeneric_Should_Work", + FullyQualifiedName = "TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod.BothGeneric_Should_Work", FilePath = @"", LineNumber = 117, Categories = global::System.Array.Empty(), @@ -1403,13 +769,145 @@ internal sealed class TUnit_TestProject_Bugs__4431_GenericClassWithGenericMethod HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry> + { + MethodName = "BothGeneric_Should_Work", + FullyQualifiedName = "TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod.BothGeneric_Should_Work", + FilePath = @"", + LineNumber = 117, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 1, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 1, + }, + }; + private static global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod __CreateInstance_1(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke_1(global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) + { + case 0: + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.BothGeneric_Should_Work()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + case 1: + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.BothGeneric_Should_Work()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } } + private static global::System.Attribute[] __Attributes_1(int groupIndex) + { + switch (groupIndex) + { + case 0: + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(int)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(string)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) + }; + } + case 1: + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(int)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(string)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) + }; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } + } + public static readonly global::TUnit.Core.TestEntry>[] Entries_1 = new global::TUnit.Core.TestEntry>[] + { + new global::TUnit.Core.TestEntry> + { + MethodName = "BothGeneric_Should_Work", + FullyQualifiedName = "TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod.BothGeneric_Should_Work", + FilePath = @"", + LineNumber = 117, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_1, + InvokeBody = __Invoke_1, + MethodIndex = 0, + CreateAttributes = __Attributes_1, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry> + { + MethodName = "BothGeneric_Should_Work", + FullyQualifiedName = "TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod.BothGeneric_Should_Work", + FilePath = @"", + LineNumber = 117, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_1, + InvokeBody = __Invoke_1, + MethodIndex = 1, + CreateAttributes = __Attributes_1, + AttributeGroupIndex = 1, + }, + }; +} +internal static partial class TUnit_TestRegistration +{ + static readonly int _r_TUnit_TestProject_Bugs__4431_GenericClassWithGenericMethod_TClass_BothGeneric_Should_Work_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__4431_GenericClassWithGenericMethod_TClass_BothGeneric_Should_Work_TestSource.Entries_0); } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__4431_GenericClassWithGenericMethod_TClass_BothGeneric_Should_Work_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithGenericMethod<>), new TUnit_TestProject_Bugs__4431_GenericClassWithGenericMethod_TClass_BothGeneric_Should_Work_TestSource()); + static readonly int _r_TUnit_TestProject_Bugs__4431_GenericClassWithGenericMethod_TClass_BothGeneric_Should_Work_TestSource_1 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__4431_GenericClassWithGenericMethod_TClass_BothGeneric_Should_Work_TestSource.Entries_1); } @@ -1422,201 +920,52 @@ internal static partial class TUnit_TestRegistration namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_Bugs__4431_GenericClassWithConstructor_T_Should_Have_Label_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal static class TUnit_TestProject_Bugs__4431_GenericClassWithConstructor_T_Should_Have_Label_TestSource { - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var __results = new global::System.Collections.Generic.List(); - // Create generic metadata with concrete type registrations - var genericMetadata = new global::TUnit.Core.GenericTestMetadata - { - TestName = "Should_Have_Label", - TestClassType = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithConstructor<>), - TestMethodName = "Should_Have_Label", - 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.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - InheritanceDepth = 0, - FilePath = @"", - LineNumber = 144, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - 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 = "Should_Have_Label", - GenericTypeCount = 0, - 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<>", 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) => - { - var genericType = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithConstructor<>); - if (typeArgs.Length > 0) - { - var closedType = genericType.MakeGenericType(typeArgs); - return global::System.Activator.CreateInstance(closedType, args)!; - } - throw new global::System.InvalidOperationException("No type arguments provided for generic class"); - }, - ConcreteInstantiations = new global::System.Collections.Generic.Dictionary - { - [(typeof(global::TUnit.TestProject.Bugs._4431.TypeA).FullName ?? typeof(global::TUnit.TestProject.Bugs._4431.TypeA).Name)] = - new global::TUnit.Core.TestMetadata> - { - TestName = "Should_Have_Label", - TestClassType = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithConstructor), - TestMethodName = "Should_Have_Label", - 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.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - FilePath = @"", - LineNumber = 144, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - 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 = "Should_Have_Label", - GenericTypeCount = 0, - 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<>", 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) => - { - return new global::TUnit.TestProject.Bugs._4431.GenericClassWithConstructor(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var typedInstance = (global::TUnit.TestProject.Bugs._4431.GenericClassWithConstructor)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.Should_Have_Label()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - } - , - [(typeof(global::TUnit.TestProject.Bugs._4431.TypeB).FullName ?? typeof(global::TUnit.TestProject.Bugs._4431.TypeB).Name)] = - new global::TUnit.Core.TestMetadata> - { - TestName = "Should_Have_Label", - TestClassType = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithConstructor), - TestMethodName = "Should_Have_Label", - 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.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - FilePath = @"", - LineNumber = 144, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - 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 = "Should_Have_Label", - GenericTypeCount = 0, - 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<>", 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) => - { - return new global::TUnit.TestProject.Bugs._4431.GenericClassWithConstructor(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var typedInstance = (global::TUnit.TestProject.Bugs._4431.GenericClassWithConstructor)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.Should_Have_Label()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - } - , - } + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithConstructor<>); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Should_Have_Label", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static global::TUnit.TestProject.Bugs._4431.GenericClassWithConstructor __CreateInstance_0(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._4431.GenericClassWithConstructor(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.Bugs._4431.GenericClassWithConstructor instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.Should_Have_Label()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) }; - genericMetadata.TestSessionId = testSessionId; - __results.Add(genericMetadata); - return __results; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry>[] Entries_0 = new global::TUnit.Core.TestEntry>[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry> { - TestId = "TUnit.TestProject.Bugs._4431.GenericClassWithConstructor.Should_Have_Label", - ClassName = "GenericClassWithConstructor", MethodName = "Should_Have_Label", - FullyQualifiedName = "TUnit.TestProject.Bugs._4431.GenericClassWithConstructor.Should_Have_Label", + FullyQualifiedName = "TUnit.TestProject.Bugs._4431.GenericClassWithConstructor.Should_Have_Label", FilePath = @"", LineNumber = 144, Categories = global::System.Array.Empty(), @@ -1624,13 +973,68 @@ internal sealed class TUnit_TestProject_Bugs__4431_GenericClassWithConstructor_T HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + }, + }; + private static global::TUnit.TestProject.Bugs._4431.GenericClassWithConstructor __CreateInstance_1(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._4431.GenericClassWithConstructor(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke_1(global::TUnit.TestProject.Bugs._4431.GenericClassWithConstructor instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.Should_Have_Label()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + private static global::System.Attribute[] __Attributes_1(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) }; } + public static readonly global::TUnit.Core.TestEntry>[] Entries_1 = new global::TUnit.Core.TestEntry>[] + { + new global::TUnit.Core.TestEntry> + { + MethodName = "Should_Have_Label", + FullyQualifiedName = "TUnit.TestProject.Bugs._4431.GenericClassWithConstructor.Should_Have_Label", + FilePath = @"", + LineNumber = 144, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_1, + InvokeBody = __Invoke_1, + MethodIndex = 0, + CreateAttributes = __Attributes_1, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__4431_GenericClassWithConstructor_T_Should_Have_Label_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithConstructor<>), new TUnit_TestProject_Bugs__4431_GenericClassWithConstructor_T_Should_Have_Label_TestSource()); + static readonly int _r_TUnit_TestProject_Bugs__4431_GenericClassWithConstructor_T_Should_Have_Label_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__4431_GenericClassWithConstructor_T_Should_Have_Label_TestSource.Entries_0); +} +internal static partial class TUnit_TestRegistration +{ + static readonly int _r_TUnit_TestProject_Bugs__4431_GenericClassWithConstructor_T_Should_Have_Label_TestSource_1 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__4431_GenericClassWithConstructor_T_Should_Have_Label_TestSource.Entries_1); } @@ -1643,201 +1047,52 @@ internal static partial class TUnit_TestRegistration namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_Bugs__4431_MultipleTypeParameters_T1_T2_Should_Handle_Multiple_Type__8C0B02C5_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal static class TUnit_TestProject_Bugs__4431_MultipleTypeParameters_T1_T2_Should_Handle_Multiple_Type__8C0B02C5_TestSource { - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var __results = new global::System.Collections.Generic.List(); - // Create generic metadata with concrete type registrations - var genericMetadata = new global::TUnit.Core.GenericTestMetadata - { - TestName = "Should_Handle_Multiple_Type_Parameters", - TestClassType = typeof(global::TUnit.TestProject.Bugs._4431.MultipleTypeParameters<,>), - TestMethodName = "Should_Handle_Multiple_Type_Parameters", - 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.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA), typeof(global::TUnit.TestProject.Bugs._4431.TypeC)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB), typeof(global::TUnit.TestProject.Bugs._4431.TypeC)) - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - InheritanceDepth = 0, - FilePath = @"", - LineNumber = 160, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - 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 = "Should_Handle_Multiple_Type_Parameters", - GenericTypeCount = 0, - 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<,>", 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) => - { - var genericType = typeof(global::TUnit.TestProject.Bugs._4431.MultipleTypeParameters<,>); - if (typeArgs.Length > 0) - { - var closedType = genericType.MakeGenericType(typeArgs); - return global::System.Activator.CreateInstance(closedType, args)!; - } - throw new global::System.InvalidOperationException("No type arguments provided for generic class"); - }, - ConcreteInstantiations = new global::System.Collections.Generic.Dictionary - { - [(typeof(global::TUnit.TestProject.Bugs._4431.TypeA).FullName ?? typeof(global::TUnit.TestProject.Bugs._4431.TypeA).Name) + "," + (typeof(global::TUnit.TestProject.Bugs._4431.TypeC).FullName ?? typeof(global::TUnit.TestProject.Bugs._4431.TypeC).Name)] = - new global::TUnit.Core.TestMetadata> - { - TestName = "Should_Handle_Multiple_Type_Parameters", - TestClassType = typeof(global::TUnit.TestProject.Bugs._4431.MultipleTypeParameters), - TestMethodName = "Should_Handle_Multiple_Type_Parameters", - 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.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA), typeof(global::TUnit.TestProject.Bugs._4431.TypeC)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB), typeof(global::TUnit.TestProject.Bugs._4431.TypeC)) - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - FilePath = @"", - LineNumber = 160, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - 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 = "Should_Handle_Multiple_Type_Parameters", - GenericTypeCount = 0, - 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<,>", 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) => - { - return new global::TUnit.TestProject.Bugs._4431.MultipleTypeParameters(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var typedInstance = (global::TUnit.TestProject.Bugs._4431.MultipleTypeParameters)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.Should_Handle_Multiple_Type_Parameters()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - } - , - [(typeof(global::TUnit.TestProject.Bugs._4431.TypeB).FullName ?? typeof(global::TUnit.TestProject.Bugs._4431.TypeB).Name) + "," + (typeof(global::TUnit.TestProject.Bugs._4431.TypeC).FullName ?? typeof(global::TUnit.TestProject.Bugs._4431.TypeC).Name)] = - new global::TUnit.Core.TestMetadata> - { - TestName = "Should_Handle_Multiple_Type_Parameters", - TestClassType = typeof(global::TUnit.TestProject.Bugs._4431.MultipleTypeParameters), - TestMethodName = "Should_Handle_Multiple_Type_Parameters", - 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.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA), typeof(global::TUnit.TestProject.Bugs._4431.TypeC)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB), typeof(global::TUnit.TestProject.Bugs._4431.TypeC)) - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - FilePath = @"", - LineNumber = 160, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - 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 = "Should_Handle_Multiple_Type_Parameters", - GenericTypeCount = 0, - 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<,>", 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) => - { - return new global::TUnit.TestProject.Bugs._4431.MultipleTypeParameters(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var typedInstance = (global::TUnit.TestProject.Bugs._4431.MultipleTypeParameters)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.Should_Handle_Multiple_Type_Parameters()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - } - , - } + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._4431.MultipleTypeParameters<,>); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Should_Handle_Multiple_Type_Parameters", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static global::TUnit.TestProject.Bugs._4431.MultipleTypeParameters __CreateInstance_0(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._4431.MultipleTypeParameters(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.Bugs._4431.MultipleTypeParameters instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.Should_Handle_Multiple_Type_Parameters()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA), typeof(global::TUnit.TestProject.Bugs._4431.TypeC)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB), typeof(global::TUnit.TestProject.Bugs._4431.TypeC)) }; - genericMetadata.TestSessionId = testSessionId; - __results.Add(genericMetadata); - return __results; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry>[] Entries_0 = new global::TUnit.Core.TestEntry>[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry> { - TestId = "TUnit.TestProject.Bugs._4431.MultipleTypeParameters.Should_Handle_Multiple_Type_Parameters", - ClassName = "MultipleTypeParameters", MethodName = "Should_Handle_Multiple_Type_Parameters", - FullyQualifiedName = "TUnit.TestProject.Bugs._4431.MultipleTypeParameters.Should_Handle_Multiple_Type_Parameters", + FullyQualifiedName = "TUnit.TestProject.Bugs._4431.MultipleTypeParameters.Should_Handle_Multiple_Type_Parameters", FilePath = @"", LineNumber = 160, Categories = global::System.Array.Empty(), @@ -1845,13 +1100,68 @@ internal sealed class TUnit_TestProject_Bugs__4431_MultipleTypeParameters_T1_T2_ HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + }, + }; + private static global::TUnit.TestProject.Bugs._4431.MultipleTypeParameters __CreateInstance_1(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._4431.MultipleTypeParameters(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke_1(global::TUnit.TestProject.Bugs._4431.MultipleTypeParameters instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.Should_Handle_Multiple_Type_Parameters()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + private static global::System.Attribute[] __Attributes_1(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA), typeof(global::TUnit.TestProject.Bugs._4431.TypeC)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB), typeof(global::TUnit.TestProject.Bugs._4431.TypeC)) }; } + public static readonly global::TUnit.Core.TestEntry>[] Entries_1 = new global::TUnit.Core.TestEntry>[] + { + new global::TUnit.Core.TestEntry> + { + MethodName = "Should_Handle_Multiple_Type_Parameters", + FullyQualifiedName = "TUnit.TestProject.Bugs._4431.MultipleTypeParameters.Should_Handle_Multiple_Type_Parameters", + FilePath = @"", + LineNumber = 160, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_1, + InvokeBody = __Invoke_1, + MethodIndex = 0, + CreateAttributes = __Attributes_1, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__4431_MultipleTypeParameters_T1_T2_Should_Handle_Multiple_Type__8C0B02C5_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._4431.MultipleTypeParameters<,>), new TUnit_TestProject_Bugs__4431_MultipleTypeParameters_T1_T2_Should_Handle_Multiple_Type__8C0B02C5_TestSource()); + static readonly int _r_TUnit_TestProject_Bugs__4431_MultipleTypeParameters_T1_T2_Should_Handle_Multiple_Type__8C0B02C5_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__4431_MultipleTypeParameters_T1_T2_Should_Handle_Multiple_Type__8C0B02C5_TestSource.Entries_0); +} +internal static partial class TUnit_TestRegistration +{ + static readonly int _r_TUnit_TestProject_Bugs__4431_MultipleTypeParameters_T1_T2_Should_Handle_Multiple_Type__8C0B02C5_TestSource_1 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__4431_MultipleTypeParameters_T1_T2_Should_Handle_Multiple_Type__8C0B02C5_TestSource.Entries_1); } @@ -1864,201 +1174,52 @@ internal static partial class TUnit_TestRegistration namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_Bugs__4431_DerivedGenericClass_T_Should_Create_From_Base_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal static class TUnit_TestProject_Bugs__4431_DerivedGenericClass_T_Should_Create_From_Base_TestSource { - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var __results = new global::System.Collections.Generic.List(); - // Create generic metadata with concrete type registrations - var genericMetadata = new global::TUnit.Core.GenericTestMetadata - { - TestName = "Should_Create_From_Base", - TestClassType = typeof(global::TUnit.TestProject.Bugs._4431.DerivedGenericClass<>), - TestMethodName = "Should_Create_From_Base", - 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.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - InheritanceDepth = 0, - FilePath = @"", - LineNumber = 184, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - 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 = "Should_Create_From_Base", - GenericTypeCount = 0, - 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<>", 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) => - { - var genericType = typeof(global::TUnit.TestProject.Bugs._4431.DerivedGenericClass<>); - if (typeArgs.Length > 0) - { - var closedType = genericType.MakeGenericType(typeArgs); - return global::System.Activator.CreateInstance(closedType, args)!; - } - throw new global::System.InvalidOperationException("No type arguments provided for generic class"); - }, - ConcreteInstantiations = new global::System.Collections.Generic.Dictionary - { - [(typeof(global::TUnit.TestProject.Bugs._4431.TypeA).FullName ?? typeof(global::TUnit.TestProject.Bugs._4431.TypeA).Name)] = - new global::TUnit.Core.TestMetadata> - { - TestName = "Should_Create_From_Base", - TestClassType = typeof(global::TUnit.TestProject.Bugs._4431.DerivedGenericClass), - TestMethodName = "Should_Create_From_Base", - 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.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - FilePath = @"", - LineNumber = 184, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - 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 = "Should_Create_From_Base", - GenericTypeCount = 0, - 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<>", 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) => - { - return new global::TUnit.TestProject.Bugs._4431.DerivedGenericClass(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var typedInstance = (global::TUnit.TestProject.Bugs._4431.DerivedGenericClass)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.Should_Create_From_Base()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - } - , - [(typeof(global::TUnit.TestProject.Bugs._4431.TypeB).FullName ?? typeof(global::TUnit.TestProject.Bugs._4431.TypeB).Name)] = - new global::TUnit.Core.TestMetadata> - { - TestName = "Should_Create_From_Base", - TestClassType = typeof(global::TUnit.TestProject.Bugs._4431.DerivedGenericClass), - TestMethodName = "Should_Create_From_Base", - 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.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - FilePath = @"", - LineNumber = 184, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - 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 = "Should_Create_From_Base", - GenericTypeCount = 0, - 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<>", 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) => - { - return new global::TUnit.TestProject.Bugs._4431.DerivedGenericClass(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var typedInstance = (global::TUnit.TestProject.Bugs._4431.DerivedGenericClass)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.Should_Create_From_Base()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - } - , - } + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._4431.DerivedGenericClass<>); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Should_Create_From_Base", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static global::TUnit.TestProject.Bugs._4431.DerivedGenericClass __CreateInstance_0(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._4431.DerivedGenericClass(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.Bugs._4431.DerivedGenericClass instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.Should_Create_From_Base()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) }; - genericMetadata.TestSessionId = testSessionId; - __results.Add(genericMetadata); - return __results; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry>[] Entries_0 = new global::TUnit.Core.TestEntry>[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry> { - TestId = "TUnit.TestProject.Bugs._4431.DerivedGenericClass.Should_Create_From_Base", - ClassName = "DerivedGenericClass", MethodName = "Should_Create_From_Base", - FullyQualifiedName = "TUnit.TestProject.Bugs._4431.DerivedGenericClass.Should_Create_From_Base", + FullyQualifiedName = "TUnit.TestProject.Bugs._4431.DerivedGenericClass.Should_Create_From_Base", FilePath = @"", LineNumber = 184, Categories = global::System.Array.Empty(), @@ -2066,13 +1227,68 @@ internal sealed class TUnit_TestProject_Bugs__4431_DerivedGenericClass_T_Should_ HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + }, + }; + private static global::TUnit.TestProject.Bugs._4431.DerivedGenericClass __CreateInstance_1(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._4431.DerivedGenericClass(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke_1(global::TUnit.TestProject.Bugs._4431.DerivedGenericClass instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.Should_Create_From_Base()); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + private static global::System.Attribute[] __Attributes_1(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) }; } + public static readonly global::TUnit.Core.TestEntry>[] Entries_1 = new global::TUnit.Core.TestEntry>[] + { + new global::TUnit.Core.TestEntry> + { + MethodName = "Should_Create_From_Base", + FullyQualifiedName = "TUnit.TestProject.Bugs._4431.DerivedGenericClass.Should_Create_From_Base", + FilePath = @"", + LineNumber = 184, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_1, + InvokeBody = __Invoke_1, + MethodIndex = 0, + CreateAttributes = __Attributes_1, + AttributeGroupIndex = 0, + }, + }; +} +internal static partial class TUnit_TestRegistration +{ + static readonly int _r_TUnit_TestProject_Bugs__4431_DerivedGenericClass_T_Should_Create_From_Base_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__4431_DerivedGenericClass_T_Should_Create_From_Base_TestSource.Entries_0); } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__4431_DerivedGenericClass_T_Should_Create_From_Base_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._4431.DerivedGenericClass<>), new TUnit_TestProject_Bugs__4431_DerivedGenericClass_T_Should_Create_From_Base_TestSource()); + static readonly int _r_TUnit_TestProject_Bugs__4431_DerivedGenericClass_T_Should_Create_From_Base_TestSource_1 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__4431_DerivedGenericClass_T_Should_Create_From_Base_TestSource.Entries_1); } @@ -2085,318 +1301,111 @@ internal static partial class TUnit_TestRegistration namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_Bugs__4431_GenericClassWithClassDataSource_T_Should_Have_DataSource_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var __results = new global::System.Collections.Generic.List(); - // Create generic metadata with concrete type registrations - var genericMetadata = new global::TUnit.Core.GenericTestMetadata - { - TestName = "Should_Have_DataSource", - TestClassType = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource<>), - TestMethodName = "Should_Have_DataSource", - 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.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = new global::TUnit.Core.PropertyInjectionData[] +internal static class TUnit_TestProject_Bugs__4431_GenericClassWithClassDataSource_T_Should_Have_DataSource_TestSource { - new global::TUnit.Core.PropertyInjectionData + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource<>", new global::TUnit.Core.ClassMetadata { - PropertyName = "DataSource", - PropertyType = typeof(global::TUnit.TestProject.Bugs._4431.TestDataSource), - Setter = (instance, value) => + 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[] { - var backingField = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource<>).GetField("k__BackingField", - global::System.Reflection.BindingFlags.Instance | global::System.Reflection.BindingFlags.NonPublic); - if (backingField != null) - { - backingField.SetValue(instance, value); - } - else + new global::TUnit.Core.PropertyMetadata { - throw new global::System.InvalidOperationException("Could not find backing field for property DataSource on type global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource<>"); + 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! } }, - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource<>); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Should_Have_DataSource", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource __CreateInstance_0(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try { - return new global::System.Collections.Generic.Dictionary(); + return new global::System.Threading.Tasks.ValueTask(instance.Should_Have_DataSource()); } - }, -}, - InheritanceDepth = 0, + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) + }; + } + public static readonly global::TUnit.Core.TestEntry>[] Entries_0 = new global::TUnit.Core.TestEntry>[] + { + new global::TUnit.Core.TestEntry> + { + MethodName = "Should_Have_DataSource", + FullyQualifiedName = "TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource.Should_Have_DataSource", FilePath = @"", LineNumber = 210, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - 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 = "Should_Have_DataSource", - GenericTypeCount = 0, - 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<>", 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[] - { - 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) => - { - var genericType = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource<>); - if (typeArgs.Length > 0) - { - var closedType = genericType.MakeGenericType(typeArgs); - return global::System.Activator.CreateInstance(closedType, args)!; - } - throw new global::System.InvalidOperationException("No type arguments provided for generic class"); - }, - ConcreteInstantiations = new global::System.Collections.Generic.Dictionary - { - [(typeof(global::TUnit.TestProject.Bugs._4431.TypeA).FullName ?? typeof(global::TUnit.TestProject.Bugs._4431.TypeA).Name)] = - new global::TUnit.Core.TestMetadata> - { - TestName = "Should_Have_DataSource", - TestClassType = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource), - TestMethodName = "Should_Have_DataSource", - 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.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = new global::TUnit.Core.PropertyInjectionData[] -{ - new global::TUnit.Core.PropertyInjectionData + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + }, + }; + private static global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource __CreateInstance_1(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke_1(global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) { - PropertyName = "DataSource", - PropertyType = typeof(global::TUnit.TestProject.Bugs._4431.TestDataSource), - Setter = (instance, value) => + try { - var backingField = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource).GetField("k__BackingField", - global::System.Reflection.BindingFlags.Instance | global::System.Reflection.BindingFlags.NonPublic); - if (backingField != null) - { - backingField.SetValue(instance, value); - } - else - { - throw new global::System.InvalidOperationException("Could not find backing field for property DataSource on type global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource"); - } - }, - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => + return new global::System.Threading.Tasks.ValueTask(instance.Should_Have_DataSource()); + } + catch (global::System.Exception ex) { - return new global::System.Collections.Generic.Dictionary(); + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } - }, -}, - FilePath = @"", - LineNumber = 210, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - 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 = "Should_Have_DataSource", - GenericTypeCount = 0, - 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<>", 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[] - { - 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) => - { - return new global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var typedInstance = (global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.Should_Have_DataSource()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - } - , - [(typeof(global::TUnit.TestProject.Bugs._4431.TypeB).FullName ?? typeof(global::TUnit.TestProject.Bugs._4431.TypeB).Name)] = - new global::TUnit.Core.TestMetadata> - { - TestName = "Should_Have_DataSource", - TestClassType = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource), - TestMethodName = "Should_Have_DataSource", - 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.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = new global::TUnit.Core.PropertyInjectionData[] -{ - new global::TUnit.Core.PropertyInjectionData + } + private static global::System.Attribute[] __Attributes_1(int groupIndex) { - PropertyName = "DataSource", - PropertyType = typeof(global::TUnit.TestProject.Bugs._4431.TestDataSource), - Setter = (instance, value) => + return new global::System.Attribute[] { - var backingField = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource).GetField("k__BackingField", - global::System.Reflection.BindingFlags.Instance | global::System.Reflection.BindingFlags.NonPublic); - if (backingField != null) - { - backingField.SetValue(instance, value); - } - else - { - throw new global::System.InvalidOperationException("Could not find backing field for property DataSource on type global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource"); - } - }, - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => - { - return new global::System.Collections.Generic.Dictionary(); - } - }, -}, - FilePath = @"", - LineNumber = 210, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - 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 = "Should_Have_DataSource", - GenericTypeCount = 0, - 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<>", 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[] - { - 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) => - { - return new global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var typedInstance = (global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.Should_Have_DataSource()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - } - , - } + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) }; - genericMetadata.TestSessionId = testSessionId; - __results.Add(genericMetadata); - return __results; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry>[] Entries_1 = new global::TUnit.Core.TestEntry>[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry> { - TestId = "TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource.Should_Have_DataSource", - ClassName = "GenericClassWithClassDataSource", MethodName = "Should_Have_DataSource", - FullyQualifiedName = "TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource.Should_Have_DataSource", + FullyQualifiedName = "TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource.Should_Have_DataSource", FilePath = @"", LineNumber = 210, Categories = global::System.Array.Empty(), @@ -2404,13 +1413,22 @@ internal sealed class TUnit_TestProject_Bugs__4431_GenericClassWithClassDataSour HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_1, + InvokeBody = __Invoke_1, + MethodIndex = 0, + CreateAttributes = __Attributes_1, + AttributeGroupIndex = 0, + }, + }; +} +internal static partial class TUnit_TestRegistration +{ + static readonly int _r_TUnit_TestProject_Bugs__4431_GenericClassWithClassDataSource_T_Should_Have_DataSource_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__4431_GenericClassWithClassDataSource_T_Should_Have_DataSource_TestSource.Entries_0); } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__4431_GenericClassWithClassDataSource_T_Should_Have_DataSource_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassWithClassDataSource<>), new TUnit_TestProject_Bugs__4431_GenericClassWithClassDataSource_T_Should_Have_DataSource_TestSource()); + static readonly int _r_TUnit_TestProject_Bugs__4431_GenericClassWithClassDataSource_T_Should_Have_DataSource_TestSource_1 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__4431_GenericClassWithClassDataSource_T_Should_Have_DataSource_TestSource.Entries_1); } @@ -2423,647 +1441,311 @@ internal static partial class TUnit_TestRegistration namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_Bugs__4431_GenericClassGenericMethodWithDataSources_TClass_FullyGene_0A3B401E_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var __results = new global::System.Collections.Generic.List(); - // Create generic metadata with concrete type registrations - var genericMetadata = new global::TUnit.Core.GenericTestMetadata - { - TestName = "FullyGeneric_With_DataSources", - TestClassType = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>), - TestMethodName = "FullyGeneric_With_DataSources", - 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.GenerateGenericTestAttribute(typeof(int)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(double)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = new global::TUnit.Core.PropertyInjectionData[] +internal static class TUnit_TestProject_Bugs__4431_GenericClassGenericMethodWithDataSources_TClass_FullyGene_0A3B401E_TestSource { - new global::TUnit.Core.PropertyInjectionData + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>", new global::TUnit.Core.ClassMetadata { - PropertyName = "DataSource", - PropertyType = typeof(global::TUnit.TestProject.Bugs._4431.TestDataSource), - Setter = (instance, value) => + 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[] { - var backingField = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>).GetField("k__BackingField", - global::System.Reflection.BindingFlags.Instance | global::System.Reflection.BindingFlags.NonPublic); - if (backingField != null) - { - backingField.SetValue(instance, value); - } - else + new global::TUnit.Core.PropertyMetadata { - throw new global::System.InvalidOperationException("Could not find backing field for property DataSource on type global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>"); + 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! } }, - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("FullyGeneric_With_DataSources", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, genericTypeCount: 1, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "flag", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]!) +}); + private static global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources __CreateInstance_0(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - return new global::System.Collections.Generic.Dictionary(); - } - }, -}, - InheritanceDepth = 0, - FilePath = @"", - LineNumber = 236, - MethodMetadata = new global::TUnit.Core.MethodMetadata + case 0: { - 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 = "FullyGeneric_With_DataSources", - GenericTypeCount = 1, - ReturnType = typeof(global::System.Threading.Tasks.Task), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), - Parameters = new global::TUnit.Core.ParameterMetadata[] + try { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "flag", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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<>", new global::TUnit.Core.ClassMetadata + return new global::System.Threading.Tasks.ValueTask(instance.FullyGeneric_With_DataSources(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + catch (global::System.Exception ex) { - 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) => + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + case 1: { - var genericType = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>); - if (typeArgs.Length > 0) + try { - var closedType = genericType.MakeGenericType(typeArgs); - return global::System.Activator.CreateInstance(closedType, args)!; + return new global::System.Threading.Tasks.ValueTask(instance.FullyGeneric_With_DataSources(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); } - throw new global::System.InvalidOperationException("No type arguments provided for generic class"); - }, - ConcreteInstantiations = new global::System.Collections.Generic.Dictionary - { - [(typeof(global::TUnit.TestProject.Bugs._4431.TypeA).FullName ?? typeof(global::TUnit.TestProject.Bugs._4431.TypeA).Name) + "," + (typeof(int).FullName ?? typeof(int).Name)] = - new global::TUnit.Core.TestMetadata> + catch (global::System.Exception ex) { - TestName = "FullyGeneric_With_DataSources", - TestClassType = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources), - TestMethodName = "FullyGeneric_With_DataSources", - GenericMethodTypeArguments = new global::System.Type[] { typeof(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), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(int)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(double)), - new global::TUnit.Core.MethodDataSourceAttribute("GetBooleans"), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) - ], - DataSources = new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("GetBooleans") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources.GetBooleans(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } - }, - }, - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = new global::TUnit.Core.PropertyInjectionData[] -{ - new global::TUnit.Core.PropertyInjectionData + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes_0(int groupIndex) { - PropertyName = "DataSource", - PropertyType = typeof(global::TUnit.TestProject.Bugs._4431.TestDataSource), - Setter = (instance, value) => + switch (groupIndex) { - var backingField = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources).GetField("k__BackingField", - global::System.Reflection.BindingFlags.Instance | global::System.Reflection.BindingFlags.NonPublic); - if (backingField != null) + case 0: { - backingField.SetValue(instance, value); + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(int)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(double)), + new global::TUnit.Core.MethodDataSourceAttribute("GetBooleans"), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) + }; } - else + case 1: { - throw new global::System.InvalidOperationException("Could not find backing field for property DataSource on type global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources"); + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(int)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(double)), + new global::TUnit.Core.MethodDataSourceAttribute("GetBooleans"), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) + }; } - }, - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => - { - return new global::System.Collections.Generic.Dictionary(); + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); } - }, -}, - FilePath = @"", - LineNumber = 236, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - 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 = "FullyGeneric_With_DataSources", - GenericTypeCount = 1, - ReturnType = typeof(global::System.Threading.Tasks.Task), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), - Parameters = new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "flag", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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<>", 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[] - { - 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) => - { - return new global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var typedInstance = (global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.FullyGeneric_With_DataSources((bool)args[0]!)); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - } - , - [(typeof(global::TUnit.TestProject.Bugs._4431.TypeA).FullName ?? typeof(global::TUnit.TestProject.Bugs._4431.TypeA).Name) + "," + (typeof(double).FullName ?? typeof(double).Name)] = - new global::TUnit.Core.TestMetadata> - { - TestName = "FullyGeneric_With_DataSources", - TestClassType = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources), - TestMethodName = "FullyGeneric_With_DataSources", - GenericMethodTypeArguments = new global::System.Type[] { typeof(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), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(int)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(double)), - new global::TUnit.Core.MethodDataSourceAttribute("GetBooleans"), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) - ], - DataSources = new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("GetBooleans") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources.GetBooleans(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } - }, - }, - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = new global::TUnit.Core.PropertyInjectionData[] + } + public static readonly global::TUnit.Core.TestEntry>[] Entries_0 = new global::TUnit.Core.TestEntry>[] + { + new global::TUnit.Core.TestEntry> + { + MethodName = "FullyGeneric_With_DataSources", + FullyQualifiedName = "TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources.FullyGeneric_With_DataSources", + FilePath = @"", + LineNumber = 236, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] { - new global::TUnit.Core.PropertyInjectionData + new global::TUnit.Core.MethodDataSourceAttribute("GetBooleans") { - PropertyName = "DataSource", - PropertyType = typeof(global::TUnit.TestProject.Bugs._4431.TestDataSource), - Setter = (instance, value) => + Factory = (dataGeneratorMetadata) => { - var backingField = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources).GetField("k__BackingField", - global::System.Reflection.BindingFlags.Instance | global::System.Reflection.BindingFlags.NonPublic); - if (backingField != null) - { - backingField.SetValue(instance, value); - } - else + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - throw new global::System.InvalidOperationException("Could not find backing field for property DataSource on type global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources"); + var result = global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources.GetBooleans(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) + { + foreach (var item in enumerable) + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + } + } + else + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } } - }, - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => - { - return new global::System.Collections.Generic.Dictionary(); + return Factory(); } }, }, - FilePath = @"", - LineNumber = 236, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - 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 = "FullyGeneric_With_DataSources", - GenericTypeCount = 1, - ReturnType = typeof(global::System.Threading.Tasks.Task), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), - Parameters = new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "flag", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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<>", 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[] - { - 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) => - { - return new global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => + }, + new global::TUnit.Core.TestEntry> + { + MethodName = "FullyGeneric_With_DataSources", + FullyQualifiedName = "TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources.FullyGeneric_With_DataSources", + FilePath = @"", + LineNumber = 236, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 1, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 1, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("GetBooleans") + { + Factory = (dataGeneratorMetadata) => + { + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + { + var result = global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources.GetBooleans(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) + { + foreach (var item in enumerable) { - try - { - var typedInstance = (global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.FullyGeneric_With_DataSources((bool)args[0]!)); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); } } - , - [(typeof(global::TUnit.TestProject.Bugs._4431.TypeB).FullName ?? typeof(global::TUnit.TestProject.Bugs._4431.TypeB).Name) + "," + (typeof(int).FullName ?? typeof(int).Name)] = - new global::TUnit.Core.TestMetadata> + else { - TestName = "FullyGeneric_With_DataSources", - TestClassType = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources), - TestMethodName = "FullyGeneric_With_DataSources", - GenericMethodTypeArguments = new global::System.Type[] { typeof(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), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(int)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(double)), - new global::TUnit.Core.MethodDataSourceAttribute("GetBooleans"), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) - ], - DataSources = new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("GetBooleans") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources.GetBooleans(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } - }, - }, - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = new global::TUnit.Core.PropertyInjectionData[] -{ - new global::TUnit.Core.PropertyInjectionData + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } + } + return Factory(); + } + }, +}, + }, + }; + private static global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources __CreateInstance_1(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke_1(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) { - PropertyName = "DataSource", - PropertyType = typeof(global::TUnit.TestProject.Bugs._4431.TestDataSource), - Setter = (instance, value) => + switch (methodIndex) { - var backingField = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources).GetField("k__BackingField", - global::System.Reflection.BindingFlags.Instance | global::System.Reflection.BindingFlags.NonPublic); - if (backingField != null) + case 0: { - backingField.SetValue(instance, value); + try + { + return new global::System.Threading.Tasks.ValueTask(instance.FullyGeneric_With_DataSources(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } } - else + case 1: { - throw new global::System.InvalidOperationException("Could not find backing field for property DataSource on type global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources"); - } - }, - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => - { - return new global::System.Collections.Generic.Dictionary(); - } - }, -}, - FilePath = @"", - LineNumber = 236, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - 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 = "FullyGeneric_With_DataSources", - GenericTypeCount = 1, - ReturnType = typeof(global::System.Threading.Tasks.Task), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), - Parameters = new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "flag", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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<>", 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[] - { - 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) => - { - return new global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var typedInstance = (global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.FullyGeneric_With_DataSources((bool)args[0]!)); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } + try + { + return new global::System.Threading.Tasks.ValueTask(instance.FullyGeneric_With_DataSources(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); } - , - [(typeof(global::TUnit.TestProject.Bugs._4431.TypeB).FullName ?? typeof(global::TUnit.TestProject.Bugs._4431.TypeB).Name) + "," + (typeof(double).FullName ?? typeof(double).Name)] = - new global::TUnit.Core.TestMetadata> + catch (global::System.Exception ex) { - TestName = "FullyGeneric_With_DataSources", - TestClassType = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources), - TestMethodName = "FullyGeneric_With_DataSources", - GenericMethodTypeArguments = new global::System.Type[] { typeof(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), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(int)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(double)), - new global::TUnit.Core.MethodDataSourceAttribute("GetBooleans"), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) - ], - DataSources = new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("GetBooleans") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources.GetBooleans(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } - }, - }, - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = new global::TUnit.Core.PropertyInjectionData[] -{ - new global::TUnit.Core.PropertyInjectionData + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes_1(int groupIndex) { - PropertyName = "DataSource", - PropertyType = typeof(global::TUnit.TestProject.Bugs._4431.TestDataSource), - Setter = (instance, value) => + switch (groupIndex) { - var backingField = typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources).GetField("k__BackingField", - global::System.Reflection.BindingFlags.Instance | global::System.Reflection.BindingFlags.NonPublic); - if (backingField != null) + case 0: { - backingField.SetValue(instance, value); + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(int)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(double)), + new global::TUnit.Core.MethodDataSourceAttribute("GetBooleans"), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) + }; } - else + case 1: { - throw new global::System.InvalidOperationException("Could not find backing field for property DataSource on type global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources"); + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(int)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(double)), + new global::TUnit.Core.MethodDataSourceAttribute("GetBooleans"), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeA)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::TUnit.TestProject.Bugs._4431.TypeB)) + }; } - }, - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => - { - return new global::System.Collections.Generic.Dictionary(); + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); } - }, -}, - FilePath = @"", - LineNumber = 236, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - 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 = "FullyGeneric_With_DataSources", - GenericTypeCount = 1, - ReturnType = typeof(global::System.Threading.Tasks.Task), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), - Parameters = new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "flag", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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<>", 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[] - { - 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) => - { - return new global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => + } + public static readonly global::TUnit.Core.TestEntry>[] Entries_1 = new global::TUnit.Core.TestEntry>[] + { + new global::TUnit.Core.TestEntry> + { + MethodName = "FullyGeneric_With_DataSources", + FullyQualifiedName = "TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources.FullyGeneric_With_DataSources", + FilePath = @"", + LineNumber = 236, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_1, + InvokeBody = __Invoke_1, + MethodIndex = 0, + CreateAttributes = __Attributes_1, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("GetBooleans") + { + Factory = (dataGeneratorMetadata) => + { + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + { + var result = global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources.GetBooleans(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) + { + foreach (var item in enumerable) { - try - { - var typedInstance = (global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.FullyGeneric_With_DataSources((bool)args[0]!)); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); } } - , + else + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } } - }; - genericMetadata.TestSessionId = testSessionId; - __results.Add(genericMetadata); - return __results; - } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor + return Factory(); + } + }, +}, + }, + new global::TUnit.Core.TestEntry> { - TestId = "TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources.FullyGeneric_With_DataSources", - ClassName = "GenericClassGenericMethodWithDataSources", - MethodName = "FullyGeneric_With_DataSources", - FullyQualifiedName = "TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources.FullyGeneric_With_DataSources", + MethodName = "FullyGeneric_With_DataSources", + FullyQualifiedName = "TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources.FullyGeneric_With_DataSources", FilePath = @"", LineNumber = 236, Categories = global::System.Array.Empty(), @@ -3071,11 +1753,45 @@ internal sealed class TUnit_TestProject_Bugs__4431_GenericClassGenericMethodWith HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_1, + InvokeBody = __Invoke_1, + MethodIndex = 1, + CreateAttributes = __Attributes_1, + AttributeGroupIndex = 1, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("GetBooleans") + { + Factory = (dataGeneratorMetadata) => + { + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + { + var result = global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources.GetBooleans(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) + { + foreach (var item in enumerable) + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + } + } + else + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } + } + return Factory(); + } + }, +}, + }, + }; +} +internal static partial class TUnit_TestRegistration +{ + static readonly int _r_TUnit_TestProject_Bugs__4431_GenericClassGenericMethodWithDataSources_TClass_FullyGene_0A3B401E_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__4431_GenericClassGenericMethodWithDataSources_TClass_FullyGene_0A3B401E_TestSource.Entries_0); } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__4431_GenericClassGenericMethodWithDataSources_TClass_FullyGene_0A3B401E_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._4431.GenericClassGenericMethodWithDataSources<>), new TUnit_TestProject_Bugs__4431_GenericClassGenericMethodWithDataSources_TClass_FullyGene_0A3B401E_TestSource()); + static readonly int _r_TUnit_TestProject_Bugs__4431_GenericClassGenericMethodWithDataSources_TClass_FullyGene_0A3B401E_TestSource_1 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__4431_GenericClassGenericMethodWithDataSources_TClass_FullyGene_0A3B401E_TestSource.Entries_1); } 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 5f63744743..a67c21ec6a 100644 --- a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_EmptyGenericRegistry_WhenNoGenericsFound.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_EmptyGenericRegistry_WhenNoGenericsFound.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,34 +7,62 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_SimpleTestClass__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("GenericTypeResolverTests:global::TUnit.TestProject.SimpleTestClass", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("GenericTypeResolverTests:global::TUnit.TestProject.SimpleTestClass", 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", "GenericTypeResolverTests"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.SimpleTestClass); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("NonGenericTest", __classType, typeof(void), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.SimpleTestClass instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) + { + case 0: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.SimpleTestClass); - var metadata_NonGenericTest = global::TUnit.Core.TestMetadataFactory.Create( - "NonGenericTest", "NonGenericTest", 7, - __InvokeTest_NonGenericTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("NonGenericTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_NonGenericTest }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.SimpleTestClass.NonGenericTest", - ClassName = "SimpleTestClass", MethodName = "NonGenericTest", FullyQualifiedName = "TUnit.TestProject.SimpleTestClass.NonGenericTest", FilePath = @"", @@ -44,56 +72,16 @@ internal static class TUnit_TestProject_SimpleTestClass__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_NonGenericTest - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_NonGenericTest(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_NonGenericTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("GenericTypeResolverTests:global::TUnit.TestProject.SimpleTestClass", 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", "GenericTypeResolverTests"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.SimpleTestClass); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "NonGenericTest", "NonGenericTest", 7, - __InvokeTest_NonGenericTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("NonGenericTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.SimpleTestClass CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.SimpleTestClass(); - } + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_SimpleTestClass__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.SimpleTestClass), TUnit_TestProject_SimpleTestClass__TestSource.GetTests, TUnit_TestProject_SimpleTestClass__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_SimpleTestClass__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_SimpleTestClass__TestSource.Entries); } 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 ca8388a672..f78345395e 100644 --- a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_GenericConstraints_WithInstantiation.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_GenericConstraints_WithInstantiation.verified.txt @@ -1,202 +1,56 @@ -// +// #pragma warning disable #nullable enable namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_ConstrainedGenericTestClass_T_TestMethod_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal static class TUnit_TestProject_ConstrainedGenericTestClass_T_TestMethod_TestSource { - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("GenericTypeResolverTests:global::TUnit.TestProject.ConstrainedGenericTestClass<>", new global::TUnit.Core.ClassMetadata { - var __results = new global::System.Collections.Generic.List(); - // Create generic metadata with concrete type registrations - var genericMetadata = new global::TUnit.Core.GenericTestMetadata + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.ConstrainedGenericTestClass<>); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("TestMethod", __classType, typeof(void), __classMetadata); + private static global::TUnit.TestProject.ConstrainedGenericTestClass __CreateInstance_0(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.ConstrainedGenericTestClass(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.ConstrainedGenericTestClass instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try { - TestName = "TestMethod", - TestClassType = typeof(global::TUnit.TestProject.ConstrainedGenericTestClass<>), - TestMethodName = "TestMethod", - Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(string)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(object)) - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - InheritanceDepth = 0, - FilePath = @"", - LineNumber = 10, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - 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 = "TestMethod", - GenericTypeCount = 0, - 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<>", 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", "GenericTypeResolverTests"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = static (typeArgs, args) => - { - var genericType = typeof(global::TUnit.TestProject.ConstrainedGenericTestClass<>); - if (typeArgs.Length > 0) - { - var closedType = genericType.MakeGenericType(typeArgs); - return global::System.Activator.CreateInstance(closedType, args)!; - } - throw new global::System.InvalidOperationException("No type arguments provided for generic class"); - }, - ConcreteInstantiations = new global::System.Collections.Generic.Dictionary - { - [(typeof(string).FullName ?? typeof(string).Name)] = - new global::TUnit.Core.TestMetadata> - { - TestName = "TestMethod", - TestClassType = typeof(global::TUnit.TestProject.ConstrainedGenericTestClass), - TestMethodName = "TestMethod", - Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(string)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(object)) - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - FilePath = @"", - LineNumber = 10, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - 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 = "TestMethod", - GenericTypeCount = 0, - 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<>", 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", "GenericTypeResolverTests"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.ConstrainedGenericTestClass(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var typedInstance = (global::TUnit.TestProject.ConstrainedGenericTestClass)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.TestMethod()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - } - , - [(typeof(object).FullName ?? typeof(object).Name)] = - new global::TUnit.Core.TestMetadata> - { - TestName = "TestMethod", - TestClassType = typeof(global::TUnit.TestProject.ConstrainedGenericTestClass), - TestMethodName = "TestMethod", - Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(string)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(object)) - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - FilePath = @"", - LineNumber = 10, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - 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 = "TestMethod", - GenericTypeCount = 0, - 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<>", 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", "GenericTypeResolverTests"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.ConstrainedGenericTestClass(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var typedInstance = (global::TUnit.TestProject.ConstrainedGenericTestClass)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.TestMethod()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - } - , - } + instance.TestMethod(); + 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)); + } + } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(string)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(object)) }; - genericMetadata.TestSessionId = testSessionId; - __results.Add(genericMetadata); - return __results; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry>[] Entries_0 = new global::TUnit.Core.TestEntry>[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry> { - TestId = "TUnit.TestProject.ConstrainedGenericTestClass.TestMethod", - ClassName = "ConstrainedGenericTestClass", MethodName = "TestMethod", - FullyQualifiedName = "TUnit.TestProject.ConstrainedGenericTestClass.TestMethod", + FullyQualifiedName = "TUnit.TestProject.ConstrainedGenericTestClass.TestMethod", FilePath = @"", LineNumber = 10, Categories = global::System.Array.Empty(), @@ -204,11 +58,66 @@ internal sealed class TUnit_TestProject_ConstrainedGenericTestClass_T_TestMethod HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + }, + }; + private static global::TUnit.TestProject.ConstrainedGenericTestClass __CreateInstance_1(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.ConstrainedGenericTestClass(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke_1(global::TUnit.TestProject.ConstrainedGenericTestClass instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.TestMethod(); + 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)); + } + } + private static global::System.Attribute[] __Attributes_1(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(string)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(object)) }; } + public static readonly global::TUnit.Core.TestEntry>[] Entries_1 = new global::TUnit.Core.TestEntry>[] + { + new global::TUnit.Core.TestEntry> + { + MethodName = "TestMethod", + FullyQualifiedName = "TUnit.TestProject.ConstrainedGenericTestClass.TestMethod", + FilePath = @"", + LineNumber = 10, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_1, + InvokeBody = __Invoke_1, + MethodIndex = 0, + CreateAttributes = __Attributes_1, + AttributeGroupIndex = 0, + }, + }; +} +internal static partial class TUnit_TestRegistration +{ + static readonly int _r_TUnit_TestProject_ConstrainedGenericTestClass_T_TestMethod_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_ConstrainedGenericTestClass_T_TestMethod_TestSource.Entries_0); } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_ConstrainedGenericTestClass_T_TestMethod_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.ConstrainedGenericTestClass<>), new TUnit_TestProject_ConstrainedGenericTestClass_T_TestMethod_TestSource()); + static readonly int _r_TUnit_TestProject_ConstrainedGenericTestClass_T_TestMethod_TestSource_1 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_ConstrainedGenericTestClass_T_TestMethod_TestSource.Entries_1); } 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 c35465369a..7e4e23678b 100644 --- a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_GenericTestClass_WithExplicitInstantiation.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_GenericTestClass_WithExplicitInstantiation.verified.txt @@ -1,202 +1,56 @@ -// +// #pragma warning disable #nullable enable namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_GenericTestClass_T_TestMethod_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal static class TUnit_TestProject_GenericTestClass_T_TestMethod_TestSource { - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("GenericTypeResolverTests:global::TUnit.TestProject.GenericTestClass<>", new global::TUnit.Core.ClassMetadata { - var __results = new global::System.Collections.Generic.List(); - // Create generic metadata with concrete type registrations - var genericMetadata = new global::TUnit.Core.GenericTestMetadata + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.GenericTestClass<>); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("TestMethod", __classType, typeof(void), __classMetadata); + private static global::TUnit.TestProject.GenericTestClass __CreateInstance_0(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.GenericTestClass(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.GenericTestClass instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try { - TestName = "TestMethod", - TestClassType = typeof(global::TUnit.TestProject.GenericTestClass<>), - TestMethodName = "TestMethod", - Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(int)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(string)) - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - InheritanceDepth = 0, - FilePath = @"", - LineNumber = 9, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - 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 = "TestMethod", - GenericTypeCount = 0, - 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<>", 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", "GenericTypeResolverTests"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = static (typeArgs, args) => - { - var genericType = typeof(global::TUnit.TestProject.GenericTestClass<>); - if (typeArgs.Length > 0) - { - var closedType = genericType.MakeGenericType(typeArgs); - return global::System.Activator.CreateInstance(closedType, args)!; - } - throw new global::System.InvalidOperationException("No type arguments provided for generic class"); - }, - ConcreteInstantiations = new global::System.Collections.Generic.Dictionary - { - [(typeof(int).FullName ?? typeof(int).Name)] = - new global::TUnit.Core.TestMetadata> - { - TestName = "TestMethod", - TestClassType = typeof(global::TUnit.TestProject.GenericTestClass), - TestMethodName = "TestMethod", - Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(int)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(string)) - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - FilePath = @"", - LineNumber = 9, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - 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 = "TestMethod", - GenericTypeCount = 0, - 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<>", 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", "GenericTypeResolverTests"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.GenericTestClass(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var typedInstance = (global::TUnit.TestProject.GenericTestClass)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.TestMethod()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - } - , - [(typeof(string).FullName ?? typeof(string).Name)] = - new global::TUnit.Core.TestMetadata> - { - TestName = "TestMethod", - TestClassType = typeof(global::TUnit.TestProject.GenericTestClass), - TestMethodName = "TestMethod", - Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(int)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(string)) - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - FilePath = @"", - LineNumber = 9, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - 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 = "TestMethod", - GenericTypeCount = 0, - 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<>", 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", "GenericTypeResolverTests"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.GenericTestClass(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var typedInstance = (global::TUnit.TestProject.GenericTestClass)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.TestMethod()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - } - , - } + instance.TestMethod(); + 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)); + } + } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(int)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(string)) }; - genericMetadata.TestSessionId = testSessionId; - __results.Add(genericMetadata); - return __results; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry>[] Entries_0 = new global::TUnit.Core.TestEntry>[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry> { - TestId = "TUnit.TestProject.GenericTestClass.TestMethod", - ClassName = "GenericTestClass", MethodName = "TestMethod", - FullyQualifiedName = "TUnit.TestProject.GenericTestClass.TestMethod", + FullyQualifiedName = "TUnit.TestProject.GenericTestClass.TestMethod", FilePath = @"", LineNumber = 9, Categories = global::System.Array.Empty(), @@ -204,11 +58,66 @@ internal sealed class TUnit_TestProject_GenericTestClass_T_TestMethod_TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + }, + }; + private static global::TUnit.TestProject.GenericTestClass __CreateInstance_1(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.GenericTestClass(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke_1(global::TUnit.TestProject.GenericTestClass instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.TestMethod(); + 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)); + } + } + private static global::System.Attribute[] __Attributes_1(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(int)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(string)) }; } + public static readonly global::TUnit.Core.TestEntry>[] Entries_1 = new global::TUnit.Core.TestEntry>[] + { + new global::TUnit.Core.TestEntry> + { + MethodName = "TestMethod", + FullyQualifiedName = "TUnit.TestProject.GenericTestClass.TestMethod", + FilePath = @"", + LineNumber = 9, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_1, + InvokeBody = __Invoke_1, + MethodIndex = 0, + CreateAttributes = __Attributes_1, + AttributeGroupIndex = 0, + }, + }; +} +internal static partial class TUnit_TestRegistration +{ + static readonly int _r_TUnit_TestProject_GenericTestClass_T_TestMethod_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_GenericTestClass_T_TestMethod_TestSource.Entries_0); } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_GenericTestClass_T_TestMethod_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.GenericTestClass<>), new TUnit_TestProject_GenericTestClass_T_TestMethod_TestSource()); + static readonly int _r_TUnit_TestProject_GenericTestClass_T_TestMethod_TestSource_1 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_GenericTestClass_T_TestMethod_TestSource.Entries_1); } 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 a0f3d9fbe4..4b78a69116 100644 --- a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_GenericTestMethod_WithExplicitInstantiation.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_GenericTestMethod_WithExplicitInstantiation.verified.txt @@ -1,198 +1,93 @@ -// +// #pragma warning disable #nullable enable namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_TestClass_GenericTestMethod_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal static class TUnit_TestProject_TestClass_GenericTestMethod_TestSource { - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("GenericTypeResolverTests:global::TUnit.TestProject.TestClass", new global::TUnit.Core.ClassMetadata { - var __results = new global::System.Collections.Generic.List(); - // Create generic metadata with concrete type registrations - var genericMetadata = new global::TUnit.Core.GenericTestMetadata + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.TestClass); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("GenericTestMethod", __classType, typeof(void), __classMetadata, genericTypeCount: 1); + private static global::TUnit.TestProject.TestClass __CreateInstance_0(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.TestClass(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.TestClass instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - TestName = "GenericTestMethod", - TestClassType = typeof(global::TUnit.TestProject.TestClass), - TestMethodName = "GenericTestMethod", - Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(int)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(string)), - new global::TUnit.Core.TestAttribute() - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - InheritanceDepth = 0, - FilePath = @"", - LineNumber = 7, - MethodMetadata = new global::TUnit.Core.MethodMetadata + case 0: { - Type = typeof(global::TUnit.TestProject.TestClass), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TestClass)), - Name = "GenericTestMethod", - GenericTypeCount = 1, - 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", new global::TUnit.Core.ClassMetadata + try { - 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) => - { - return new global::TUnit.TestProject.TestClass(); - }, - ConcreteInstantiations = new global::System.Collections.Generic.Dictionary + instance.GenericTestMethod(); + 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)); + } + } + case 1: { - [(typeof(int).FullName ?? typeof(int).Name)] = - new global::TUnit.Core.TestMetadata + try { - TestName = "GenericTestMethod", - TestClassType = typeof(global::TUnit.TestProject.TestClass), - TestMethodName = "GenericTestMethod", - GenericMethodTypeArguments = new global::System.Type[] { typeof(int)}, - Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(int)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(string)), - new global::TUnit.Core.TestAttribute() - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - FilePath = @"", - LineNumber = 7, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - Type = typeof(global::TUnit.TestProject.TestClass), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TestClass)), - Name = "GenericTestMethod", - GenericTypeCount = 1, - 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", 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", "GenericTypeResolverTests"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.TestClass(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var typedInstance = (global::TUnit.TestProject.TestClass)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.GenericTestMethod()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } + instance.GenericTestMethod(); + return default(global::System.Threading.Tasks.ValueTask); } - , - [(typeof(string).FullName ?? typeof(string).Name)] = - new global::TUnit.Core.TestMetadata + catch (global::System.Exception ex) { - TestName = "GenericTestMethod", - TestClassType = typeof(global::TUnit.TestProject.TestClass), - TestMethodName = "GenericTestMethod", - GenericMethodTypeArguments = new global::System.Type[] { typeof(string)}, - Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(int)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(string)), - new global::TUnit.Core.TestAttribute() - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - FilePath = @"", - LineNumber = 7, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - Type = typeof(global::TUnit.TestProject.TestClass), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TestClass)), - Name = "GenericTestMethod", - GenericTypeCount = 1, - 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", 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", "GenericTypeResolverTests"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.TestClass(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var typedInstance = (global::TUnit.TestProject.TestClass)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.GenericTestMethod()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } - , } - }; - genericMetadata.TestSessionId = testSessionId; - __results.Add(genericMetadata); - return __results; + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + switch (groupIndex) + { + case 0: + { + return new global::System.Attribute[] + { + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(int)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(string)), + new global::TUnit.Core.TestAttribute() + }; + } + case 1: + { + return new global::System.Attribute[] + { + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(int)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(string)), + new global::TUnit.Core.TestAttribute() + }; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.TestClass.GenericTestMethod", - ClassName = "TestClass", - MethodName = "GenericTestMethod", - FullyQualifiedName = "TUnit.TestProject.TestClass.GenericTestMethod", + MethodName = "GenericTestMethod", + FullyQualifiedName = "TUnit.TestProject.TestClass.GenericTestMethod", FilePath = @"", LineNumber = 7, Categories = global::System.Array.Empty(), @@ -200,11 +95,34 @@ internal sealed class TUnit_TestProject_TestClass_GenericTestMethod_TestSource : HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry + { + MethodName = "GenericTestMethod", + FullyQualifiedName = "TUnit.TestProject.TestClass.GenericTestMethod", + FilePath = @"", + LineNumber = 7, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 1, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 1, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_TestClass_GenericTestMethod_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.TestClass), new TUnit_TestProject_TestClass_GenericTestMethod_TestSource()); + static readonly int _r_TUnit_TestProject_TestClass_GenericTestMethod_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_TestClass_GenericTestMethod_TestSource.Entries_0); } diff --git a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_MultipleGenericParameters.verified.txt b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_MultipleGenericParameters.verified.txt index 278513d57a..95ae3748f9 100644 --- a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_MultipleGenericParameters.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_MultipleGenericParameters.verified.txt @@ -1,202 +1,56 @@ -// +// #pragma warning disable #nullable enable namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_MultiGenericTestClass_T1_T2_TestMethod_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal static class TUnit_TestProject_MultiGenericTestClass_T1_T2_TestMethod_TestSource { - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("GenericTypeResolverTests:global::TUnit.TestProject.MultiGenericTestClass<,>", new global::TUnit.Core.ClassMetadata { - var __results = new global::System.Collections.Generic.List(); - // Create generic metadata with concrete type registrations - var genericMetadata = new global::TUnit.Core.GenericTestMetadata + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.MultiGenericTestClass<,>); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("TestMethod", __classType, typeof(void), __classMetadata); + private static global::TUnit.TestProject.MultiGenericTestClass __CreateInstance_0(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MultiGenericTestClass(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.MultiGenericTestClass instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try { - TestName = "TestMethod", - TestClassType = typeof(global::TUnit.TestProject.MultiGenericTestClass<,>), - TestMethodName = "TestMethod", - Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(int), typeof(string)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(bool), typeof(double)) - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - InheritanceDepth = 0, - FilePath = @"", - LineNumber = 9, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - 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 = "TestMethod", - GenericTypeCount = 0, - 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<,>", 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", "GenericTypeResolverTests"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = static (typeArgs, args) => - { - var genericType = typeof(global::TUnit.TestProject.MultiGenericTestClass<,>); - if (typeArgs.Length > 0) - { - var closedType = genericType.MakeGenericType(typeArgs); - return global::System.Activator.CreateInstance(closedType, args)!; - } - throw new global::System.InvalidOperationException("No type arguments provided for generic class"); - }, - ConcreteInstantiations = new global::System.Collections.Generic.Dictionary - { - [(typeof(int).FullName ?? typeof(int).Name) + "," + (typeof(string).FullName ?? typeof(string).Name)] = - new global::TUnit.Core.TestMetadata> - { - TestName = "TestMethod", - TestClassType = typeof(global::TUnit.TestProject.MultiGenericTestClass), - TestMethodName = "TestMethod", - Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(int), typeof(string)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(bool), typeof(double)) - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - FilePath = @"", - LineNumber = 9, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - 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 = "TestMethod", - GenericTypeCount = 0, - 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<,>", 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", "GenericTypeResolverTests"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.MultiGenericTestClass(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var typedInstance = (global::TUnit.TestProject.MultiGenericTestClass)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.TestMethod()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - } - , - [(typeof(bool).FullName ?? typeof(bool).Name) + "," + (typeof(double).FullName ?? typeof(double).Name)] = - new global::TUnit.Core.TestMetadata> - { - TestName = "TestMethod", - TestClassType = typeof(global::TUnit.TestProject.MultiGenericTestClass), - TestMethodName = "TestMethod", - Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(int), typeof(string)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(bool), typeof(double)) - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - FilePath = @"", - LineNumber = 9, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - 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 = "TestMethod", - GenericTypeCount = 0, - 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<,>", 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", "GenericTypeResolverTests"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.MultiGenericTestClass(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var typedInstance = (global::TUnit.TestProject.MultiGenericTestClass)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.TestMethod()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - } - , - } + instance.TestMethod(); + 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)); + } + } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(int), typeof(string)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(bool), typeof(double)) }; - genericMetadata.TestSessionId = testSessionId; - __results.Add(genericMetadata); - return __results; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry>[] Entries_0 = new global::TUnit.Core.TestEntry>[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry> { - TestId = "TUnit.TestProject.MultiGenericTestClass.TestMethod", - ClassName = "MultiGenericTestClass", MethodName = "TestMethod", - FullyQualifiedName = "TUnit.TestProject.MultiGenericTestClass.TestMethod", + FullyQualifiedName = "TUnit.TestProject.MultiGenericTestClass.TestMethod", FilePath = @"", LineNumber = 9, Categories = global::System.Array.Empty(), @@ -204,11 +58,66 @@ internal sealed class TUnit_TestProject_MultiGenericTestClass_T1_T2_TestMethod_T HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + }, + }; + private static global::TUnit.TestProject.MultiGenericTestClass __CreateInstance_1(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.MultiGenericTestClass(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke_1(global::TUnit.TestProject.MultiGenericTestClass instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.TestMethod(); + 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)); + } + } + private static global::System.Attribute[] __Attributes_1(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(int), typeof(string)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(bool), typeof(double)) }; } + public static readonly global::TUnit.Core.TestEntry>[] Entries_1 = new global::TUnit.Core.TestEntry>[] + { + new global::TUnit.Core.TestEntry> + { + MethodName = "TestMethod", + FullyQualifiedName = "TUnit.TestProject.MultiGenericTestClass.TestMethod", + FilePath = @"", + LineNumber = 9, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_1, + InvokeBody = __Invoke_1, + MethodIndex = 0, + CreateAttributes = __Attributes_1, + AttributeGroupIndex = 0, + }, + }; +} +internal static partial class TUnit_TestRegistration +{ + static readonly int _r_TUnit_TestProject_MultiGenericTestClass_T1_T2_TestMethod_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_MultiGenericTestClass_T1_T2_TestMethod_TestSource.Entries_0); } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_MultiGenericTestClass_T1_T2_TestMethod_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.MultiGenericTestClass<,>), new TUnit_TestProject_MultiGenericTestClass_T1_T2_TestMethod_TestSource()); + static readonly int _r_TUnit_TestProject_MultiGenericTestClass_T1_T2_TestMethod_TestSource_1 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_MultiGenericTestClass_T1_T2_TestMethod_TestSource.Entries_1); } diff --git a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_NestedGenericTypes.verified.txt b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_NestedGenericTypes.verified.txt index 208c388363..9ed3d9dddd 100644 --- a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_NestedGenericTypes.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_NestedGenericTypes.verified.txt @@ -1,202 +1,56 @@ -// +// #pragma warning disable #nullable enable namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_NestedGenericTestClass_T_TestMethod_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal static class TUnit_TestProject_NestedGenericTestClass_T_TestMethod_TestSource { - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("GenericTypeResolverTests:global::TUnit.TestProject.NestedGenericTestClass<>", new global::TUnit.Core.ClassMetadata { - var __results = new global::System.Collections.Generic.List(); - // Create generic metadata with concrete type registrations - var genericMetadata = new global::TUnit.Core.GenericTestMetadata + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.NestedGenericTestClass<>); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("TestMethod", __classType, typeof(void), __classMetadata); + private static global::TUnit.TestProject.NestedGenericTestClass> __CreateInstance_0(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.NestedGenericTestClass>(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.NestedGenericTestClass> instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try { - TestName = "TestMethod", - TestClassType = typeof(global::TUnit.TestProject.NestedGenericTestClass<>), - TestMethodName = "TestMethod", - Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::System.Collections.Generic.List)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::System.Collections.Generic.Dictionary)) - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - InheritanceDepth = 0, - FilePath = @"", - LineNumber = 10, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - 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 = "TestMethod", - GenericTypeCount = 0, - 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<>", 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", "GenericTypeResolverTests"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = static (typeArgs, args) => - { - var genericType = typeof(global::TUnit.TestProject.NestedGenericTestClass<>); - if (typeArgs.Length > 0) - { - var closedType = genericType.MakeGenericType(typeArgs); - return global::System.Activator.CreateInstance(closedType, args)!; - } - throw new global::System.InvalidOperationException("No type arguments provided for generic class"); - }, - ConcreteInstantiations = new global::System.Collections.Generic.Dictionary - { - [(typeof(global::System.Collections.Generic.List).FullName ?? typeof(global::System.Collections.Generic.List).Name)] = - new global::TUnit.Core.TestMetadata>> - { - TestName = "TestMethod", - TestClassType = typeof(global::TUnit.TestProject.NestedGenericTestClass>), - TestMethodName = "TestMethod", - Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::System.Collections.Generic.List)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::System.Collections.Generic.Dictionary)) - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - FilePath = @"", - LineNumber = 10, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - 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 = "TestMethod", - GenericTypeCount = 0, - 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<>", 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", "GenericTypeResolverTests"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.NestedGenericTestClass>(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var typedInstance = (global::TUnit.TestProject.NestedGenericTestClass>)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.TestMethod()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - } - , - [(typeof(global::System.Collections.Generic.Dictionary).FullName ?? typeof(global::System.Collections.Generic.Dictionary).Name)] = - new global::TUnit.Core.TestMetadata>> - { - TestName = "TestMethod", - TestClassType = typeof(global::TUnit.TestProject.NestedGenericTestClass>), - TestMethodName = "TestMethod", - Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::System.Collections.Generic.List)), - new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::System.Collections.Generic.Dictionary)) - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - FilePath = @"", - LineNumber = 10, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - 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 = "TestMethod", - GenericTypeCount = 0, - 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<>", 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", "GenericTypeResolverTests"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.NestedGenericTestClass>(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var typedInstance = (global::TUnit.TestProject.NestedGenericTestClass>)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.TestMethod()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - } - , - } + instance.TestMethod(); + 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)); + } + } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::System.Collections.Generic.List)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::System.Collections.Generic.Dictionary)) }; - genericMetadata.TestSessionId = testSessionId; - __results.Add(genericMetadata); - return __results; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry>>[] Entries_0 = new global::TUnit.Core.TestEntry>>[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry>> { - TestId = "TUnit.TestProject.NestedGenericTestClass.TestMethod", - ClassName = "NestedGenericTestClass", MethodName = "TestMethod", - FullyQualifiedName = "TUnit.TestProject.NestedGenericTestClass.TestMethod", + FullyQualifiedName = "TUnit.TestProject.NestedGenericTestClass>.TestMethod", FilePath = @"", LineNumber = 10, Categories = global::System.Array.Empty(), @@ -204,11 +58,66 @@ internal sealed class TUnit_TestProject_NestedGenericTestClass_T_TestMethod_Test HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + }, + }; + private static global::TUnit.TestProject.NestedGenericTestClass> __CreateInstance_1(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.NestedGenericTestClass>(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke_1(global::TUnit.TestProject.NestedGenericTestClass> instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + instance.TestMethod(); + 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)); + } + } + private static global::System.Attribute[] __Attributes_1(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::System.Collections.Generic.List)), + new global::TUnit.Core.GenerateGenericTestAttribute(typeof(global::System.Collections.Generic.Dictionary)) }; } + public static readonly global::TUnit.Core.TestEntry>>[] Entries_1 = new global::TUnit.Core.TestEntry>>[] + { + new global::TUnit.Core.TestEntry>> + { + MethodName = "TestMethod", + FullyQualifiedName = "TUnit.TestProject.NestedGenericTestClass>.TestMethod", + FilePath = @"", + LineNumber = 10, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_1, + InvokeBody = __Invoke_1, + MethodIndex = 0, + CreateAttributes = __Attributes_1, + AttributeGroupIndex = 0, + }, + }; +} +internal static partial class TUnit_TestRegistration +{ + static readonly int _r_TUnit_TestProject_NestedGenericTestClass_T_TestMethod_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_NestedGenericTestClass_T_TestMethod_TestSource.Entries_0); } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_NestedGenericTestClass_T_TestMethod_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.NestedGenericTestClass<>), new TUnit_TestProject_NestedGenericTestClass_T_TestMethod_TestSource()); + static readonly int _r_TUnit_TestProject_NestedGenericTestClass_T_TestMethod_TestSource_1 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_NestedGenericTestClass_T_TestMethod_TestSource.Entries_1); } diff --git a/TUnit.Core.SourceGenerator.Tests/Hooks1589.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Hooks1589.Test.verified.txt index aa5d9eaf4e..886e162947 100644 --- a/TUnit.Core.SourceGenerator.Tests/Hooks1589.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Hooks1589.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,42 +7,67 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_Bugs__1589_MyTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1589.MyTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1589.MyTests", 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", "TestsBase`1"), - Parameters = new global::TUnit.Core.ParameterMetadata[] + global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Bugs._1589.MyFixture), "myFixture", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1589.MyFixture)), false, reflectionInfoFactory: static () => 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._1589.MyTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Test1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.Bugs._1589.MyTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) + { + case 0: { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Bugs._1589.MyFixture), "myFixture", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1589.MyFixture)), false, reflectionInfoFactory: static () => 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 - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._1589.MyTests); - var metadata_Test1 = global::TUnit.Core.TestMetadataFactory.Create( - "Test1", "Test1", 15, - __InvokeTest_Test1, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - new global::TUnit.Core.ClassDataSourceAttribute() - {Shared = global::TUnit.Core.SharedType.None,}, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_Test1 }; + case 0: + { + 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,} + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.Bugs._1589.MyTests.Test1", - ClassName = "MyTests", MethodName = "Test1", FullyQualifiedName = "TUnit.TestProject.Bugs._1589.MyTests.Test1", FilePath = @"", @@ -52,66 +77,21 @@ internal static class TUnit_TestProject_Bugs__1589_MyTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Test1 - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - 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::System.Threading.Tasks.ValueTask __InvokeTest_Test1(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test1(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1589.MyTests", 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[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Bugs._1589.MyFixture), "myFixture", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1589.MyFixture)), false, reflectionInfoFactory: static () => 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 - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._1589.MyTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Test1", "Test1", 15, - __InvokeTest_Test1, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ClassDataSourceAttribute() - {Shared = global::TUnit.Core.SharedType.None,}, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal 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])); - } + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ClassDataSourceAttribute() +{Shared = global::TUnit.Core.SharedType.None,}, +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__1589_MyTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._1589.MyTests), TUnit_TestProject_Bugs__1589_MyTests__TestSource.GetTests, TUnit_TestProject_Bugs__1589_MyTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_Bugs__1589_MyTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__1589_MyTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/Hooks1594.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Hooks1594.Test.verified.txt index 60c5e3c5c3..c92411f87d 100644 --- a/TUnit.Core.SourceGenerator.Tests/Hooks1594.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Hooks1594.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,42 +7,68 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_Bugs__1594_MyTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1594.MyTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1594.MyTests", 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", "TestsBase`1"), - Parameters = new global::TUnit.Core.ParameterMetadata[] + global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Bugs._1594.MyFixture), "myFixture", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1594.MyFixture)), false, reflectionInfoFactory: static () => 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._1594.MyTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Test1", __classType, typeof(void), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.Bugs._1594.MyTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) + { + case 0: { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Bugs._1594.MyFixture), "myFixture", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1594.MyFixture)), false, reflectionInfoFactory: static () => 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 - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._1594.MyTests); - var metadata_Test1 = global::TUnit.Core.TestMetadataFactory.Create( - "Test1", "Test1", 15, - __InvokeTest_Test1, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test1", __classType, typeof(void), __classMetadata), - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - new global::TUnit.Core.ClassDataSourceAttribute() - {Shared = global::TUnit.Core.SharedType.None,}, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_Test1 }; + case 0: + { + 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,} + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.Bugs._1594.MyTests.Test1", - ClassName = "MyTests", MethodName = "Test1", FullyQualifiedName = "TUnit.TestProject.Bugs._1594.MyTests.Test1", FilePath = @"", @@ -52,67 +78,21 @@ internal static class TUnit_TestProject_Bugs__1594_MyTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Test1 - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - 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::System.Threading.Tasks.ValueTask __InvokeTest_Test1(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test1(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1594.MyTests", 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[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Bugs._1594.MyFixture), "myFixture", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1594.MyFixture)), false, reflectionInfoFactory: static () => 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 - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._1594.MyTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Test1", "Test1", 15, - __InvokeTest_Test1, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test1", __classType, typeof(void), __classMetadata), - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ClassDataSourceAttribute() - {Shared = global::TUnit.Core.SharedType.None,}, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal 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])); - } + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ClassDataSourceAttribute() +{Shared = global::TUnit.Core.SharedType.None,}, +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__1594_MyTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._1594.MyTests), TUnit_TestProject_Bugs__1594_MyTests__TestSource.GetTests, TUnit_TestProject_Bugs__1594_MyTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_Bugs__1594_MyTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__1594_MyTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/InheritedPropertySetterTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/InheritedPropertySetterTests.Test.verified.txt index 917ef801ad..0a69be00d8 100644 --- a/TUnit.Core.SourceGenerator.Tests/InheritedPropertySetterTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/InheritedPropertySetterTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -21,276 +21,162 @@ internal static class TUnit_TestProject_PropertySetterTests__TestSource [global::System.Runtime.CompilerServices.UnsafeAccessor(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Field, Name = "k__BackingField")] private static extern ref string GetProperty7BackingField(global::TUnit.TestProject.PropertySetterTests instance); #endif - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.PropertySetterTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.PropertySetterTests", 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", "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 - }); - var __classType = typeof(global::TUnit.TestProject.PropertySetterTests); - var metadata_Test = global::TUnit.Core.TestMetadataFactory.Create( - "Test", "Test", 69, - __InvokeTest_Test, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - propertyDataSources: new global::TUnit.Core.PropertyDataSource[] - { - new global::TUnit.Core.PropertyDataSource + new global::TUnit.Core.PropertyMetadata { - PropertyName = "Property2", - PropertyType = typeof(string), - DataSource = new global::TUnit.Core.MethodDataSourceAttribute("MethodData") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.PropertySetterTests.MethodData(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, + 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.PropertyDataSource + new global::TUnit.Core.PropertyMetadata { - PropertyName = "Property3", - PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - DataSource = new global::TUnit.Core.ClassDataSourceAttribute(), + 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.PropertyDataSource + new global::TUnit.Core.PropertyMetadata { - PropertyName = "Property4", - PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - DataSource = new global::TUnit.Core.ClassDataSourceAttribute() - {Shared = global::TUnit.Core.SharedType.PerTestSession,}, + 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.PropertyDataSource + new global::TUnit.Core.PropertyMetadata { - PropertyName = "Property5", - PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - DataSource = new global::TUnit.Core.ClassDataSourceAttribute() - {Shared = global::TUnit.Core.SharedType.PerClass,}, + 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.PropertyDataSource + new global::TUnit.Core.PropertyMetadata { - PropertyName = "Property6", - PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - DataSource = new global::TUnit.Core.ClassDataSourceAttribute() - {Shared = global::TUnit.Core.SharedType.Keyed,Key = "Key",}, + 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.PropertyDataSource + new global::TUnit.Core.PropertyMetadata { - PropertyName = "Property7", - PropertyType = typeof(string), - DataSource = new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), + 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! + } }, - propertyInjections: new global::TUnit.Core.PropertyInjectionData[] + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.PropertySetterTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Test", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static global::TUnit.TestProject.PropertySetterTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.PropertySetterTests() { - new global::TUnit.Core.PropertyInjectionData - { - PropertyName = "Property2", - PropertyType = typeof(string), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetProperty2BackingField((global::TUnit.TestProject.PropertySetterTests)instance) = (string)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => - { - return new global::System.Collections.Generic.Dictionary(); - } - }, - new global::TUnit.Core.PropertyInjectionData - { - PropertyName = "Property3", - PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetProperty3BackingField((global::TUnit.TestProject.PropertySetterTests)instance) = (global::TUnit.TestProject.PropertySetterTests.InnerModel)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => - { - return new global::System.Collections.Generic.Dictionary(); - } - }, - new global::TUnit.Core.PropertyInjectionData - { - PropertyName = "Property4", - PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetProperty4BackingField((global::TUnit.TestProject.PropertySetterTests)instance) = (global::TUnit.TestProject.PropertySetterTests.InnerModel)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => - { - return new global::System.Collections.Generic.Dictionary(); - } - }, - new global::TUnit.Core.PropertyInjectionData + Property1 = default!, + Property2 = default!, + Property3 = default!, + Property4 = default!, + Property5 = default!, + Property6 = default!, + Property7 = default!, + }; + } + private static global::System.Threading.Tasks.ValueTask __Invoke(global::TUnit.TestProject.PropertySetterTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) + { + case 0: { - PropertyName = "Property5", - PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetProperty5BackingField((global::TUnit.TestProject.PropertySetterTests)instance) = (global::TUnit.TestProject.PropertySetterTests.InnerModel)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => + try { - return new global::System.Collections.Generic.Dictionary(); + return new global::System.Threading.Tasks.ValueTask(instance.Test()); } - }, - new global::TUnit.Core.PropertyInjectionData - { - PropertyName = "Property6", - PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetProperty6BackingField((global::TUnit.TestProject.PropertySetterTests)instance) = (global::TUnit.TestProject.PropertySetterTests.InnerModel)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => + catch (global::System.Exception ex) { - return new global::System.Collections.Generic.Dictionary(); + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } - }, - new global::TUnit.Core.PropertyInjectionData + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) + { + case 0: { - PropertyName = "Property7", - PropertyType = typeof(string), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetProperty7BackingField((global::TUnit.TestProject.PropertySetterTests)instance) = (string)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => - { - return new global::System.Collections.Generic.Dictionary(); - } - }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_Test }; + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.NotInParallelAttribute("PropertySetterTests") + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.PropertySetterTests.Test", - ClassName = "PropertySetterTests", MethodName = "Test", FullyQualifiedName = "TUnit.TestProject.PropertySetterTests.Test", FilePath = @"", @@ -300,310 +186,18 @@ internal static class TUnit_TestProject_PropertySetterTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Test - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - 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::System.Threading.Tasks.ValueTask __InvokeTest_Test(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.PropertySetterTests", 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[] - { - 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! - } - }, - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.PropertySetterTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Test", "Test", 69, - __InvokeTest_Test, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - propertyDataSources: new global::TUnit.Core.PropertyDataSource[] - { - new global::TUnit.Core.PropertyDataSource - { - PropertyName = "Property2", - PropertyType = typeof(string), - DataSource = new global::TUnit.Core.MethodDataSourceAttribute("MethodData") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.PropertySetterTests.MethodData(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, - }, - new global::TUnit.Core.PropertyDataSource - { - PropertyName = "Property3", - PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - DataSource = new global::TUnit.Core.ClassDataSourceAttribute(), - }, - new global::TUnit.Core.PropertyDataSource - { - PropertyName = "Property4", - PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - DataSource = new global::TUnit.Core.ClassDataSourceAttribute() - {Shared = global::TUnit.Core.SharedType.PerTestSession,}, - }, - new global::TUnit.Core.PropertyDataSource - { - PropertyName = "Property5", - PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - DataSource = new global::TUnit.Core.ClassDataSourceAttribute() - {Shared = global::TUnit.Core.SharedType.PerClass,}, - }, - new global::TUnit.Core.PropertyDataSource - { - PropertyName = "Property6", - PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - DataSource = new global::TUnit.Core.ClassDataSourceAttribute() - {Shared = global::TUnit.Core.SharedType.Keyed,Key = "Key",}, - }, - new global::TUnit.Core.PropertyDataSource - { - PropertyName = "Property7", - PropertyType = typeof(string), - DataSource = new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, }, - }, - propertyInjections: new global::TUnit.Core.PropertyInjectionData[] - { - new global::TUnit.Core.PropertyInjectionData - { - PropertyName = "Property2", - PropertyType = typeof(string), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetProperty2BackingField((global::TUnit.TestProject.PropertySetterTests)instance) = (string)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => - { - return new global::System.Collections.Generic.Dictionary(); - } - }, - new global::TUnit.Core.PropertyInjectionData - { - PropertyName = "Property3", - PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetProperty3BackingField((global::TUnit.TestProject.PropertySetterTests)instance) = (global::TUnit.TestProject.PropertySetterTests.InnerModel)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => - { - return new global::System.Collections.Generic.Dictionary(); - } - }, - new global::TUnit.Core.PropertyInjectionData - { - PropertyName = "Property4", - PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetProperty4BackingField((global::TUnit.TestProject.PropertySetterTests)instance) = (global::TUnit.TestProject.PropertySetterTests.InnerModel)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => - { - return new global::System.Collections.Generic.Dictionary(); - } - }, - new global::TUnit.Core.PropertyInjectionData - { - PropertyName = "Property5", - PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetProperty5BackingField((global::TUnit.TestProject.PropertySetterTests)instance) = (global::TUnit.TestProject.PropertySetterTests.InnerModel)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => - { - return new global::System.Collections.Generic.Dictionary(); - } - }, - new global::TUnit.Core.PropertyInjectionData - { - PropertyName = "Property6", - PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetProperty6BackingField((global::TUnit.TestProject.PropertySetterTests)instance) = (global::TUnit.TestProject.PropertySetterTests.InnerModel)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => - { - return new global::System.Collections.Generic.Dictionary(); - } - }, - new global::TUnit.Core.PropertyInjectionData - { - PropertyName = "Property7", - PropertyType = typeof(string), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetProperty7BackingField((global::TUnit.TestProject.PropertySetterTests)instance) = (string)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => - { - return new global::System.Collections.Generic.Dictionary(); - } - }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal 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!, - }; - } + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_PropertySetterTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.PropertySetterTests), TUnit_TestProject_PropertySetterTests__TestSource.GetTests, TUnit_TestProject_PropertySetterTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_PropertySetterTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_PropertySetterTests__TestSource.Entries); } @@ -616,233 +210,22 @@ internal static partial class TUnit_TestRegistration namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_InheritedPropertySetterTests_Test_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - #if NET8_0_OR_GREATER - [global::System.Runtime.CompilerServices.UnsafeAccessor(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Field, Name = "k__BackingField")] - private static extern ref string GetProperty2BackingField(global::TUnit.TestProject.PropertySetterTests instance); - [global::System.Runtime.CompilerServices.UnsafeAccessor(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Field, Name = "k__BackingField")] - private static extern ref global::TUnit.TestProject.PropertySetterTests.InnerModel GetProperty3BackingField(global::TUnit.TestProject.PropertySetterTests instance); - [global::System.Runtime.CompilerServices.UnsafeAccessor(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Field, Name = "k__BackingField")] - private static extern ref global::TUnit.TestProject.PropertySetterTests.InnerModel GetProperty4BackingField(global::TUnit.TestProject.PropertySetterTests instance); - [global::System.Runtime.CompilerServices.UnsafeAccessor(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Field, Name = "k__BackingField")] - private static extern ref global::TUnit.TestProject.PropertySetterTests.InnerModel GetProperty5BackingField(global::TUnit.TestProject.PropertySetterTests instance); - [global::System.Runtime.CompilerServices.UnsafeAccessor(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Field, Name = "k__BackingField")] - private static extern ref global::TUnit.TestProject.PropertySetterTests.InnerModel GetProperty6BackingField(global::TUnit.TestProject.PropertySetterTests instance); - [global::System.Runtime.CompilerServices.UnsafeAccessor(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Field, Name = "k__BackingField")] - private static extern ref string GetProperty7BackingField(global::TUnit.TestProject.PropertySetterTests instance); - #endif - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata - { - TestName = "Test", - TestClassType = typeof(global::TUnit.TestProject.InheritedPropertySetterTests), - TestMethodName = "Test", - Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = new global::TUnit.Core.PropertyDataSource[] - { - new global::TUnit.Core.PropertyDataSource - { - PropertyName = "Property2", - PropertyType = typeof(string), - DataSource = new global::TUnit.Core.MethodDataSourceAttribute("MethodData"), - }, - new global::TUnit.Core.PropertyDataSource - { - PropertyName = "Property3", - PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - DataSource = new global::TUnit.Core.ClassDataSourceAttribute(), - }, - new global::TUnit.Core.PropertyDataSource - { - PropertyName = "Property4", - PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - DataSource = new global::TUnit.Core.ClassDataSourceAttribute() -{Shared = global::TUnit.Core.SharedType.PerTestSession,}, - }, - new global::TUnit.Core.PropertyDataSource - { - PropertyName = "Property5", - PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - DataSource = new global::TUnit.Core.ClassDataSourceAttribute() -{Shared = global::TUnit.Core.SharedType.PerClass,}, - }, - new global::TUnit.Core.PropertyDataSource - { - PropertyName = "Property6", - PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - DataSource = new global::TUnit.Core.ClassDataSourceAttribute() -{Shared = global::TUnit.Core.SharedType.Keyed,Key = "Key",}, - }, - new global::TUnit.Core.PropertyDataSource - { - PropertyName = "Property7", - PropertyType = typeof(string), - DataSource = new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), - }, - }, - PropertyInjections = new global::TUnit.Core.PropertyInjectionData[] +internal static class TUnit_TestProject_InheritedPropertySetterTests_Test_TestSource { - new global::TUnit.Core.PropertyInjectionData - { - PropertyName = "Property2", - PropertyType = typeof(string), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetProperty2BackingField((global::TUnit.TestProject.PropertySetterTests)instance) = (string)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => - { - return new global::System.Collections.Generic.Dictionary(); - } - }, - new global::TUnit.Core.PropertyInjectionData - { - PropertyName = "Property3", - PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetProperty3BackingField((global::TUnit.TestProject.PropertySetterTests)instance) = (global::TUnit.TestProject.PropertySetterTests.InnerModel)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => - { - return new global::System.Collections.Generic.Dictionary(); - } - }, - new global::TUnit.Core.PropertyInjectionData - { - PropertyName = "Property4", - PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetProperty4BackingField((global::TUnit.TestProject.PropertySetterTests)instance) = (global::TUnit.TestProject.PropertySetterTests.InnerModel)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => - { - return new global::System.Collections.Generic.Dictionary(); - } - }, - new global::TUnit.Core.PropertyInjectionData - { - PropertyName = "Property5", - PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetProperty5BackingField((global::TUnit.TestProject.PropertySetterTests)instance) = (global::TUnit.TestProject.PropertySetterTests.InnerModel)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => - { - return new global::System.Collections.Generic.Dictionary(); - } - }, - new global::TUnit.Core.PropertyInjectionData - { - PropertyName = "Property6", - PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetProperty6BackingField((global::TUnit.TestProject.PropertySetterTests)instance) = (global::TUnit.TestProject.PropertySetterTests.InnerModel)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => - { - return new global::System.Collections.Generic.Dictionary(); - } - }, - new global::TUnit.Core.PropertyInjectionData - { - PropertyName = "Property7", - PropertyType = typeof(string), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetProperty7BackingField((global::TUnit.TestProject.PropertySetterTests)instance) = (string)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => - { - return new global::System.Collections.Generic.Dictionary(); - } - }, -}, - InheritanceDepth = 1, - FilePath = @"", - LineNumber = 3, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - Type = typeof(global::TUnit.TestProject.PropertySetterTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.PropertySetterTests)), - Name = "Test", - GenericTypeCount = 0, - 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", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = __CreateInstance, - InvokeTypedTest = __InvokeTest, - }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.InheritedPropertySetterTests.Test", - ClassName = "InheritedPropertySetterTests", - MethodName = "Test", - FullyQualifiedName = "TUnit.TestProject.InheritedPropertySetterTests.Test", - FilePath = @"", - LineNumber = 3, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } - private static global::System.Attribute[] __CreateAttributes() + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.InheritedPropertySetterTests", new global::TUnit.Core.ClassMetadata { - 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) + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.InheritedPropertySetterTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Test", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static global::TUnit.TestProject.InheritedPropertySetterTests __CreateInstance_0(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.InheritedPropertySetterTests() { @@ -855,7 +238,7 @@ internal sealed class TUnit_TestProject_InheritedPropertySetterTests_Test_TestSo Property7 = default!, }; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.InheritedPropertySetterTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.InheritedPropertySetterTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -866,8 +249,39 @@ internal sealed class TUnit_TestProject_InheritedPropertySetterTests_Test_TestSo return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + return new global::System.Attribute[] + { + 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") + }; + } + public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry + { + MethodName = "Test", + FullyQualifiedName = "TUnit.TestProject.InheritedPropertySetterTests.Test", + FilePath = @"", + LineNumber = 3, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_InheritedPropertySetterTests_Test_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.InheritedPropertySetterTests), new TUnit_TestProject_InheritedPropertySetterTests_Test_TestSource()); + static readonly int _r_TUnit_TestProject_InheritedPropertySetterTests_Test_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_InheritedPropertySetterTests_Test_TestSource.Entries_0); } diff --git a/TUnit.Core.SourceGenerator.Tests/InheritedTestsFromDifferentProjectTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/InheritedTestsFromDifferentProjectTests.Test.verified.txt index 13eca376f2..cf1f00ad4c 100644 --- a/TUnit.Core.SourceGenerator.Tests/InheritedTestsFromDifferentProjectTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/InheritedTestsFromDifferentProjectTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,88 +7,125 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_InheritedTestsFromDifferentProjectTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests); - var metadata_Test = global::TUnit.Core.TestMetadataFactory.Create( - "Test", "Test", 9, - __InvokeTest_Test, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - var metadata_GenericMethodDataSource__string = global::TUnit.Core.TestMetadataFactory.Create( - "GenericMethodDataSource", "GenericMethodDataSource", 14, - __InvokeTest_GenericMethodDataSource__string, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("GenericMethodDataSource", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Test", __classType, typeof(void), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("GenericMethodDataSource", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("NonGenericMethodDataSource", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_3 = global::TUnit.Core.MethodMetadataFactory.Create("VerifyInheritedCategoriesAreAvailable", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - new global::TUnit.Core.MethodDataSourceAttribute("Foo") + case 0: + { + 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)); + } + } + case 1: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.TestData.Foo(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + 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}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - var metadata_NonGenericMethodDataSource__string = global::TUnit.Core.TestMetadataFactory.Create( - "NonGenericMethodDataSource", "NonGenericMethodDataSource", 20, - __InvokeTest_NonGenericMethodDataSource__string, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("NonGenericMethodDataSource", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.TestData), "Foo") + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + case 2: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.TestData.Foo(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + 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}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - var metadata_VerifyInheritedCategoriesAreAvailable = global::TUnit.Core.TestMetadataFactory.Create( - "VerifyInheritedCategoriesAreAvailable", "VerifyInheritedCategoriesAreAvailable", 26, - __InvokeTest_VerifyInheritedCategoriesAreAvailable, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("VerifyInheritedCategoriesAreAvailable", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_Test, metadata_GenericMethodDataSource__string, metadata_NonGenericMethodDataSource__string, metadata_VerifyInheritedCategoriesAreAvailable }; + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + case 3: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(Pass), + new global::TUnit.Core.InheritsTestsAttribute(), + new global::TUnit.Core.CategoryAttribute("BaseCategoriesOnClass") + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.InheritedTestsFromDifferentProjectTests.Test", - ClassName = "InheritedTestsFromDifferentProjectTests", MethodName = "Test", FullyQualifiedName = "TUnit.TestProject.InheritedTestsFromDifferentProjectTests.Test", FilePath = @"", @@ -98,12 +135,15 @@ internal static class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Test - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.InheritedTestsFromDifferentProjectTests.GenericMethodDataSource", - ClassName = "InheritedTestsFromDifferentProjectTests", MethodName = "GenericMethodDataSource", FullyQualifiedName = "TUnit.TestProject.InheritedTestsFromDifferentProjectTests.GenericMethodDataSource", FilePath = @"", @@ -113,12 +153,30 @@ internal static class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_GenericMethodDataSource__string - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("Foo") + { + Factory = (dataGeneratorMetadata) => + { + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + { + var result = global::TUnit.TestProject.TestData.Foo(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } + return Factory(); + } + }, +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.InheritedTestsFromDifferentProjectTests.NonGenericMethodDataSource", - ClassName = "InheritedTestsFromDifferentProjectTests", MethodName = "NonGenericMethodDataSource", FullyQualifiedName = "TUnit.TestProject.InheritedTestsFromDifferentProjectTests.NonGenericMethodDataSource", FilePath = @"", @@ -128,12 +186,30 @@ internal static class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_NonGenericMethodDataSource__string - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.TestData), "Foo") + { + Factory = (dataGeneratorMetadata) => + { + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + { + var result = global::TUnit.TestProject.TestData.Foo(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } + return Factory(); + } + }, +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.InheritedTestsFromDifferentProjectTests.VerifyInheritedCategoriesAreAvailable", - ClassName = "InheritedTestsFromDifferentProjectTests", MethodName = "VerifyInheritedCategoriesAreAvailable", FullyQualifiedName = "TUnit.TestProject.InheritedTestsFromDifferentProjectTests.VerifyInheritedCategoriesAreAvailable", FilePath = @"", @@ -143,214 +219,18 @@ internal static class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_VerifyInheritedCategoriesAreAvailable - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - 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::System.Threading.Tasks.ValueTask __InvokeTest_Test(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_GenericMethodDataSource__string(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_NonGenericMethodDataSource__string(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_VerifyInheritedCategoriesAreAvailable(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Test", "Test", 9, - __InvokeTest_Test, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_GenericMethodDataSource__string(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "GenericMethodDataSource", "GenericMethodDataSource", 14, - __InvokeTest_GenericMethodDataSource__string, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("GenericMethodDataSource", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("Foo") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.TestData.Foo(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_NonGenericMethodDataSource__string(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "NonGenericMethodDataSource", "NonGenericMethodDataSource", 20, - __InvokeTest_NonGenericMethodDataSource__string, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("NonGenericMethodDataSource", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.TestData), "Foo") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.TestData.Foo(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } + MethodMetadata = __mm_3, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 3, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_VerifyInheritedCategoriesAreAvailable(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "VerifyInheritedCategoriesAreAvailable", "VerifyInheritedCategoriesAreAvailable", 26, - __InvokeTest_VerifyInheritedCategoriesAreAvailable, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("VerifyInheritedCategoriesAreAvailable", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests(); - } + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_InheritedTestsFromDifferentProjectTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), TUnit_TestProject_InheritedTestsFromDifferentProjectTests__TestSource.GetTests, TUnit_TestProject_InheritedTestsFromDifferentProjectTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_InheritedTestsFromDifferentProjectTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_InheritedTestsFromDifferentProjectTests__TestSource.Entries); } @@ -363,85 +243,26 @@ internal static partial class TUnit_TestRegistration namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_BaseTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal static class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_BaseTest_TestSource { - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests", new global::TUnit.Core.ClassMetadata { - var metadata = new global::TUnit.Core.TestMetadata - { - TestName = "BaseTest", - TestClassType = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), - TestMethodName = "BaseTest", - Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - InheritanceDepth = 1, - FilePath = @"", - LineNumber = 5, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - Type = typeof(global::TUnit.TestProject.Library.BaseTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.BaseTests)), - Name = "BaseTest", - GenericTypeCount = 0, - 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", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = __CreateInstance, - InvokeTypedTest = __InvokeTest, - }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.InheritedTestsFromDifferentProjectTests.BaseTest", - ClassName = "InheritedTestsFromDifferentProjectTests", - MethodName = "BaseTest", - FullyQualifiedName = "TUnit.TestProject.InheritedTestsFromDifferentProjectTests.BaseTest", - FilePath = @"", - LineNumber = 5, - Categories = new string[] { "BaseCategory" }, - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - 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) + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("BaseTest", __classType, typeof(void), __classMetadata); + private static global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests __CreateInstance_0(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) + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -453,10 +274,42 @@ internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + return new global::System.Attribute[] + { + 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") + }; + } + public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry + { + MethodName = "BaseTest", + FullyQualifiedName = "TUnit.TestProject.InheritedTestsFromDifferentProjectTests.BaseTest", + FilePath = @"", + LineNumber = 5, + Categories = new string[] { "BaseCategory" }, + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_InheritedTestsFromDifferentProjectTests_BaseTest_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), new TUnit_TestProject_InheritedTestsFromDifferentProjectTests_BaseTest_TestSource()); + static readonly int _r_TUnit_TestProject_InheritedTestsFromDifferentProjectTests_BaseTest_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_InheritedTestsFromDifferentProjectTests_BaseTest_TestSource.Entries_0); } @@ -469,86 +322,26 @@ internal static partial class TUnit_TestRegistration namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_BaseTestWithMultipleCategories_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal static class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_BaseTestWithMultipleCategories_TestSource { - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests", new global::TUnit.Core.ClassMetadata { - var metadata = new global::TUnit.Core.TestMetadata - { - TestName = "BaseTestWithMultipleCategories", - TestClassType = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), - TestMethodName = "BaseTestWithMultipleCategories", - Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - InheritanceDepth = 1, - FilePath = @"", - LineNumber = 5, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - Type = typeof(global::TUnit.TestProject.Library.BaseTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.BaseTests)), - Name = "BaseTestWithMultipleCategories", - GenericTypeCount = 0, - 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", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = __CreateInstance, - InvokeTypedTest = __InvokeTest, - }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.InheritedTestsFromDifferentProjectTests.BaseTestWithMultipleCategories", - ClassName = "InheritedTestsFromDifferentProjectTests", - MethodName = "BaseTestWithMultipleCategories", - FullyQualifiedName = "TUnit.TestProject.InheritedTestsFromDifferentProjectTests.BaseTestWithMultipleCategories", - FilePath = @"", - LineNumber = 5, - Categories = new string[] { "AnotherBaseCategory", "MultipleCategories" }, - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - 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) + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("BaseTestWithMultipleCategories", __classType, typeof(void), __classMetadata); + private static global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests __CreateInstance_0(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) + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -560,8 +353,41 @@ internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + return new global::System.Attribute[] + { + 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") + }; + } + public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry + { + MethodName = "BaseTestWithMultipleCategories", + FullyQualifiedName = "TUnit.TestProject.InheritedTestsFromDifferentProjectTests.BaseTestWithMultipleCategories", + FilePath = @"", + LineNumber = 5, + Categories = new string[] { "AnotherBaseCategory", "MultipleCategories" }, + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_InheritedTestsFromDifferentProjectTests_BaseTestWithMultipleCategories_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), new TUnit_TestProject_InheritedTestsFromDifferentProjectTests_BaseTestWithMultipleCategories_TestSource()); + static readonly int _r_TUnit_TestProject_InheritedTestsFromDifferentProjectTests_BaseTestWithMultipleCategories_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_InheritedTestsFromDifferentProjectTests_BaseTestWithMultipleCategories_TestSource.Entries_0); } diff --git a/TUnit.Core.SourceGenerator.Tests/InheritsTestsAbstractTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/InheritsTestsAbstractTests.Test.verified.txt index 9d37c10762..b258156575 100644 --- a/TUnit.Core.SourceGenerator.Tests/InheritsTestsAbstractTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/InheritsTestsAbstractTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,34 +7,64 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_AbstractTests_ConcreteClass2__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AbstractTests.ConcreteClass2", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("SecondTest", __classType, typeof(void), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.AbstractTests.ConcreteClass2 instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AbstractTests.ConcreteClass2", new global::TUnit.Core.ClassMetadata + switch (methodIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2); - var metadata_SecondTest = global::TUnit.Core.TestMetadataFactory.Create( - "SecondTest", "SecondTest", 11, - __InvokeTest_SecondTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SecondTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_SecondTest }; + case 0: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Attribute[] __Attributes(int groupIndex) { - yield return new global::TUnit.Core.TestDescriptor + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.InheritsTestsAttribute(), + new global::TUnit.Core.InheritsTestsAttribute() + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } + } + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.AbstractTests.ConcreteClass2.SecondTest", - ClassName = "ConcreteClass2", MethodName = "SecondTest", FullyQualifiedName = "TUnit.TestProject.AbstractTests.ConcreteClass2.SecondTest", FilePath = @"", @@ -44,60 +74,18 @@ internal static class TUnit_TestProject_AbstractTests_ConcreteClass2__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_SecondTest - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.InheritsTestsAttribute(), - new global::TUnit.Core.InheritsTestsAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_SecondTest(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_SecondTest(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AbstractTests.ConcreteClass2", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "SecondTest", "SecondTest", 11, - __InvokeTest_SecondTest, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SecondTest", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.AbstractTests.ConcreteClass2 CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.AbstractTests.ConcreteClass2(); - } + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_AbstractTests_ConcreteClass2__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), TUnit_TestProject_AbstractTests_ConcreteClass2__TestSource.GetTests, TUnit_TestProject_AbstractTests_ConcreteClass2__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_AbstractTests_ConcreteClass2__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_AbstractTests_ConcreteClass2__TestSource.Entries); } @@ -110,57 +98,49 @@ internal static partial class TUnit_TestRegistration namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_AssertClassName_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal static class TUnit_TestProject_AbstractTests_ConcreteClass2_AssertClassName_TestSource { - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AbstractTests.ConcreteClass2", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("AssertClassName", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static global::TUnit.TestProject.AbstractTests.ConcreteClass2 __CreateInstance_0(global::System.Type[] typeArgs, object?[] args) { - var metadata = new global::TUnit.Core.TestMetadata + return new global::TUnit.TestProject.AbstractTests.ConcreteClass2(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.AbstractTests.ConcreteClass2 instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try { - TestName = "AssertClassName", - TestClassType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), - TestMethodName = "AssertClassName", - Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - InheritanceDepth = 2, - FilePath = @"", - LineNumber = 3, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - Type = typeof(global::TUnit.TestProject.AbstractTests.AbstractBaseClass), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AbstractTests.AbstractBaseClass)), - Name = "AssertClassName", - GenericTypeCount = 0, - 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", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = __CreateInstance, - InvokeTypedTest = __InvokeTest, + 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)); + } + } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.InheritsTestsAttribute(), + new global::TUnit.Core.InheritsTestsAttribute() }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.AbstractTests.ConcreteClass2.AssertClassName", - ClassName = "ConcreteClass2", MethodName = "AssertClassName", FullyQualifiedName = "TUnit.TestProject.AbstractTests.ConcreteClass2.AssertClassName", FilePath = @"", @@ -170,37 +150,18 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_AssertClass HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - 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)); - } - } + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_AbstractTests_ConcreteClass2_AssertClassName_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), new TUnit_TestProject_AbstractTests_ConcreteClass2_AssertClassName_TestSource()); + static readonly int _r_TUnit_TestProject_AbstractTests_ConcreteClass2_AssertClassName_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_AbstractTests_ConcreteClass2_AssertClassName_TestSource.Entries_0); } @@ -213,57 +174,48 @@ internal static partial class TUnit_TestRegistration namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClassName_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal static class TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClassName_TestSource { - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AbstractTests.ConcreteClass1", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("AssertClassName", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static global::TUnit.TestProject.AbstractTests.ConcreteClass1 __CreateInstance_0(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.AbstractTests.ConcreteClass1(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.AbstractTests.ConcreteClass1 instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) { - var metadata = new global::TUnit.Core.TestMetadata + try { - TestName = "AssertClassName", - TestClassType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1), - TestMethodName = "AssertClassName", - Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - InheritanceDepth = 1, - FilePath = @"", - LineNumber = 3, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - Type = typeof(global::TUnit.TestProject.AbstractTests.AbstractBaseClass), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AbstractTests.AbstractBaseClass)), - Name = "AssertClassName", - GenericTypeCount = 0, - 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", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = __CreateInstance, - InvokeTypedTest = __InvokeTest, + 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)); + } + } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.InheritsTestsAttribute() }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.AbstractTests.ConcreteClass1.AssertClassName", - ClassName = "ConcreteClass1", MethodName = "AssertClassName", FullyQualifiedName = "TUnit.TestProject.AbstractTests.ConcreteClass1.AssertClassName", FilePath = @"", @@ -273,34 +225,16 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClass HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - 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)); - } - } + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClassName_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1), new TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClassName_TestSource()); + static readonly int _r_TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClassName_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_AbstractTests_ConcreteClass1_AssertClassName_TestSource.Entries_0); } diff --git a/TUnit.Core.SourceGenerator.Tests/InheritsTestsTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/InheritsTestsTests.Test.verified.txt index 04606efcb9..b3d6ff71a5 100644 --- a/TUnit.Core.SourceGenerator.Tests/InheritsTestsTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/InheritsTestsTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -11,209 +11,117 @@ internal static class TUnit_TestProject_Bugs__1924_None_BaseClass__TestSource [global::System.Runtime.CompilerServices.UnsafeAccessor(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Field, Name = "k__BackingField")] private static extern ref global::TUnit.TestProject.Bugs._1924.DataClass GetDataBackingField(global::TUnit.TestProject.Bugs._1924.None.BaseClass instance); #endif - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1924.None.BaseClass", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1924.None.BaseClass", 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", "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 - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._1924.None.BaseClass); - var metadata_Test__int = global::TUnit.Core.TestMetadataFactory.Create( - "Test", "Test", 11, - __InvokeTest_Test__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1), - new global::TUnit.Core.ArgumentsAttribute(2), - new global::TUnit.Core.ArgumentsAttribute(3), - }, - propertyDataSources: new global::TUnit.Core.PropertyDataSource[] - { - new global::TUnit.Core.PropertyDataSource - { - PropertyName = "Data", - PropertyType = typeof(global::TUnit.TestProject.Bugs._1924.DataClass), - DataSource = new global::TUnit.Core.ClassDataSourceAttribute(), - }, - }, - propertyInjections: new global::TUnit.Core.PropertyInjectionData[] - { - new global::TUnit.Core.PropertyInjectionData - { - PropertyName = "Data", - PropertyType = typeof(global::TUnit.TestProject.Bugs._1924.DataClass), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetDataBackingField((global::TUnit.TestProject.Bugs._1924.None.BaseClass)instance) = (global::TUnit.TestProject.Bugs._1924.DataClass)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => - { - return new global::System.Collections.Generic.Dictionary(); - } - }, + 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! + } }, - repeatCount: 10, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_Test__int }; - } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._1924.None.BaseClass); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Test", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static global::TUnit.TestProject.Bugs._1924.None.BaseClass __CreateInstance(global::System.Type[] typeArgs, object?[] args) { - yield return new global::TUnit.Core.TestDescriptor + return new global::TUnit.TestProject.Bugs._1924.None.BaseClass() { - TestId = "TUnit.TestProject.Bugs._1924.None.BaseClass.Test", - ClassName = "BaseClass", - MethodName = "Test", - FullyQualifiedName = "TUnit.TestProject.Bugs._1924.None.BaseClass.Test", - FilePath = @"", - LineNumber = 11, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 10, - DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Test__int + Data = default!, }; } - private static global::System.Attribute[] __CreateAttributes_0() - { - 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::System.Threading.Tasks.ValueTask __InvokeTest_Test__int(global::TUnit.TestProject.Bugs._1924.None.BaseClass instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __Invoke(global::TUnit.TestProject.Bugs._1924.None.BaseClass instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) { - try + switch (methodIndex) { - switch (args.Length) + case 0: { - case 1: + try + { + switch (args.Length) { - return new global::System.Threading.Tasks.ValueTask(instance.Test(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + 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}"); } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); } } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1924.None.BaseClass", 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[] - { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._1924.None.BaseClass); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Test", "Test", 11, - __InvokeTest_Test__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1), - new global::TUnit.Core.ArgumentsAttribute(2), - new global::TUnit.Core.ArgumentsAttribute(3), - }, - propertyDataSources: new global::TUnit.Core.PropertyDataSource[] + private static global::System.Attribute[] __Attributes(int groupIndex) { - new global::TUnit.Core.PropertyDataSource + switch (groupIndex) { - PropertyName = "Data", - PropertyType = typeof(global::TUnit.TestProject.Bugs._1924.DataClass), - DataSource = new global::TUnit.Core.ClassDataSourceAttribute(), - }, - }, - propertyInjections: new global::TUnit.Core.PropertyInjectionData[] - { - new global::TUnit.Core.PropertyInjectionData - { - PropertyName = "Data", - PropertyType = typeof(global::TUnit.TestProject.Bugs._1924.DataClass), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetDataBackingField((global::TUnit.TestProject.Bugs._1924.None.BaseClass)instance) = (global::TUnit.TestProject.Bugs._1924.DataClass)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => + case 0: { - return new global::System.Collections.Generic.Dictionary(); + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.RepeatAttribute(10), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; } - }, - }, - repeatCount: 10, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - internal static global::TUnit.TestProject.Bugs._1924.None.BaseClass CreateInstance(global::System.Type[] typeArgs, object?[] args) + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - return new global::TUnit.TestProject.Bugs._1924.None.BaseClass() + new global::TUnit.Core.TestEntry { - Data = default!, - }; - } + MethodName = "Test", + FullyQualifiedName = "TUnit.TestProject.Bugs._1924.None.BaseClass.Test", + FilePath = @"", + LineNumber = 11, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 10, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(1), + new global::TUnit.Core.ArgumentsAttribute(2), + new global::TUnit.Core.ArgumentsAttribute(3), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__1924_None_BaseClass__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._1924.None.BaseClass), TUnit_TestProject_Bugs__1924_None_BaseClass__TestSource.GetTests, TUnit_TestProject_Bugs__1924_None_BaseClass__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_Bugs__1924_None_BaseClass__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__1924_None_BaseClass__TestSource.Entries); } @@ -226,126 +134,32 @@ internal static partial class TUnit_TestRegistration namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_Bugs__1924_None_Tests_Test__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal static class TUnit_TestProject_Bugs__1924_None_Tests_Test__int_TestSource { - #if NET8_0_OR_GREATER - [global::System.Runtime.CompilerServices.UnsafeAccessor(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Field, Name = "k__BackingField")] - private static extern ref global::TUnit.TestProject.Bugs._1924.DataClass GetDataBackingField(global::TUnit.TestProject.Bugs._1924.None.BaseClass instance); - #endif - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1924.None.Tests", new global::TUnit.Core.ClassMetadata { - var metadata = new global::TUnit.Core.TestMetadata - { - TestName = "Test", - TestClassType = typeof(global::TUnit.TestProject.Bugs._1924.None.Tests), - TestMethodName = "Test", - Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 10, - DataSources = new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1), - new global::TUnit.Core.ArgumentsAttribute(2), - new global::TUnit.Core.ArgumentsAttribute(3), - }, - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = new global::TUnit.Core.PropertyDataSource[] - { - new global::TUnit.Core.PropertyDataSource - { - PropertyName = "Data", - PropertyType = typeof(global::TUnit.TestProject.Bugs._1924.DataClass), - DataSource = new global::TUnit.Core.ClassDataSourceAttribute(), - }, - }, - PropertyInjections = new global::TUnit.Core.PropertyInjectionData[] + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._1924.None.Tests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Test", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] { - new global::TUnit.Core.PropertyInjectionData - { - PropertyName = "Data", - PropertyType = typeof(global::TUnit.TestProject.Bugs._1924.DataClass), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetDataBackingField((global::TUnit.TestProject.Bugs._1924.None.BaseClass)instance) = (global::TUnit.TestProject.Bugs._1924.DataClass)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => - { - return new global::System.Collections.Generic.Dictionary(); - } - }, -}, - InheritanceDepth = 1, - FilePath = @"", - LineNumber = 23, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._1924.None.BaseClass), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1924.None.BaseClass)), - Name = "Test", - GenericTypeCount = 0, - ReturnType = typeof(global::System.Threading.Tasks.Task), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), - Parameters = new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = __CreateInstance, - InvokeTypedTest = __InvokeTest, - }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.Bugs._1924.None.Tests.Test", - ClassName = "Tests", - MethodName = "Test", - FullyQualifiedName = "TUnit.TestProject.Bugs._1924.None.Tests.Test", - FilePath = @"", - LineNumber = 23, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 10, - DependsOn = global::System.Array.Empty(), - 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) +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static global::TUnit.TestProject.Bugs._1924.None.Tests __CreateInstance_0(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) + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.Bugs._1924.None.Tests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -364,10 +178,50 @@ internal sealed class TUnit_TestProject_Bugs__1924_None_Tests_Test__int_TestSour return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.ArgumentsAttribute(1), + new global::TUnit.Core.ArgumentsAttribute(2), + new global::TUnit.Core.ArgumentsAttribute(3), + new global::TUnit.Core.RepeatAttribute(10), + new global::TUnit.Core.InheritsTestsAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + }; + } + public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry + { + MethodName = "Test", + FullyQualifiedName = "TUnit.TestProject.Bugs._1924.None.Tests.Test", + FilePath = @"", + LineNumber = 23, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 10, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(1), + new global::TUnit.Core.ArgumentsAttribute(2), + new global::TUnit.Core.ArgumentsAttribute(3), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__1924_None_Tests_Test__int_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._1924.None.Tests), new TUnit_TestProject_Bugs__1924_None_Tests_Test__int_TestSource()); + static readonly int _r_TUnit_TestProject_Bugs__1924_None_Tests_Test__int_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__1924_None_Tests_Test__int_TestSource.Entries_0); } @@ -380,126 +234,32 @@ internal static partial class TUnit_TestRegistration namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_Bugs__1924_None_Tests2_Test__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal static class TUnit_TestProject_Bugs__1924_None_Tests2_Test__int_TestSource { - #if NET8_0_OR_GREATER - [global::System.Runtime.CompilerServices.UnsafeAccessor(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Field, Name = "k__BackingField")] - private static extern ref global::TUnit.TestProject.Bugs._1924.DataClass GetDataBackingField(global::TUnit.TestProject.Bugs._1924.None.BaseClass instance); - #endif - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1924.None.Tests2", new global::TUnit.Core.ClassMetadata { - var metadata = new global::TUnit.Core.TestMetadata - { - TestName = "Test", - TestClassType = typeof(global::TUnit.TestProject.Bugs._1924.None.Tests2), - TestMethodName = "Test", - Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 10, - DataSources = new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1), - new global::TUnit.Core.ArgumentsAttribute(2), - new global::TUnit.Core.ArgumentsAttribute(3), - }, - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = new global::TUnit.Core.PropertyDataSource[] - { - new global::TUnit.Core.PropertyDataSource - { - PropertyName = "Data", - PropertyType = typeof(global::TUnit.TestProject.Bugs._1924.DataClass), - DataSource = new global::TUnit.Core.ClassDataSourceAttribute(), - }, - }, - PropertyInjections = new global::TUnit.Core.PropertyInjectionData[] + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._1924.None.Tests2); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Test", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] { - new global::TUnit.Core.PropertyInjectionData - { - PropertyName = "Data", - PropertyType = typeof(global::TUnit.TestProject.Bugs._1924.DataClass), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetDataBackingField((global::TUnit.TestProject.Bugs._1924.None.BaseClass)instance) = (global::TUnit.TestProject.Bugs._1924.DataClass)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => - { - return new global::System.Collections.Generic.Dictionary(); - } - }, -}, - InheritanceDepth = 1, - FilePath = @"", - LineNumber = 26, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._1924.None.BaseClass), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1924.None.BaseClass)), - Name = "Test", - GenericTypeCount = 0, - ReturnType = typeof(global::System.Threading.Tasks.Task), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), - Parameters = new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = __CreateInstance, - InvokeTypedTest = __InvokeTest, - }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.Bugs._1924.None.Tests2.Test", - ClassName = "Tests2", - MethodName = "Test", - FullyQualifiedName = "TUnit.TestProject.Bugs._1924.None.Tests2.Test", - FilePath = @"", - LineNumber = 26, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 10, - DependsOn = global::System.Array.Empty(), - 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) +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static global::TUnit.TestProject.Bugs._1924.None.Tests2 __CreateInstance_0(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) + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.Bugs._1924.None.Tests2 instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -518,10 +278,50 @@ internal sealed class TUnit_TestProject_Bugs__1924_None_Tests2_Test__int_TestSou return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.ArgumentsAttribute(1), + new global::TUnit.Core.ArgumentsAttribute(2), + new global::TUnit.Core.ArgumentsAttribute(3), + new global::TUnit.Core.RepeatAttribute(10), + new global::TUnit.Core.InheritsTestsAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + }; + } + public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry + { + MethodName = "Test", + FullyQualifiedName = "TUnit.TestProject.Bugs._1924.None.Tests2.Test", + FilePath = @"", + LineNumber = 26, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 10, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(1), + new global::TUnit.Core.ArgumentsAttribute(2), + new global::TUnit.Core.ArgumentsAttribute(3), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__1924_None_Tests2_Test__int_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._1924.None.Tests2), new TUnit_TestProject_Bugs__1924_None_Tests2_Test__int_TestSource()); + static readonly int _r_TUnit_TestProject_Bugs__1924_None_Tests2_Test__int_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__1924_None_Tests2_Test__int_TestSource.Entries_0); } @@ -534,126 +334,32 @@ internal static partial class TUnit_TestRegistration namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_Bugs__1924_None_Tests3_Test__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal static class TUnit_TestProject_Bugs__1924_None_Tests3_Test__int_TestSource { - #if NET8_0_OR_GREATER - [global::System.Runtime.CompilerServices.UnsafeAccessor(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Field, Name = "k__BackingField")] - private static extern ref global::TUnit.TestProject.Bugs._1924.DataClass GetDataBackingField(global::TUnit.TestProject.Bugs._1924.None.BaseClass instance); - #endif - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1924.None.Tests3", new global::TUnit.Core.ClassMetadata { - var metadata = new global::TUnit.Core.TestMetadata - { - TestName = "Test", - TestClassType = typeof(global::TUnit.TestProject.Bugs._1924.None.Tests3), - TestMethodName = "Test", - Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 10, - DataSources = new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1), - new global::TUnit.Core.ArgumentsAttribute(2), - new global::TUnit.Core.ArgumentsAttribute(3), - }, - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = new global::TUnit.Core.PropertyDataSource[] - { - new global::TUnit.Core.PropertyDataSource - { - PropertyName = "Data", - PropertyType = typeof(global::TUnit.TestProject.Bugs._1924.DataClass), - DataSource = new global::TUnit.Core.ClassDataSourceAttribute(), - }, - }, - PropertyInjections = new global::TUnit.Core.PropertyInjectionData[] + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._1924.None.Tests3); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Test", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] { - new global::TUnit.Core.PropertyInjectionData - { - PropertyName = "Data", - PropertyType = typeof(global::TUnit.TestProject.Bugs._1924.DataClass), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetDataBackingField((global::TUnit.TestProject.Bugs._1924.None.BaseClass)instance) = (global::TUnit.TestProject.Bugs._1924.DataClass)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => - { - return new global::System.Collections.Generic.Dictionary(); - } - }, -}, - InheritanceDepth = 1, - FilePath = @"", - LineNumber = 29, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._1924.None.BaseClass), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1924.None.BaseClass)), - Name = "Test", - GenericTypeCount = 0, - ReturnType = typeof(global::System.Threading.Tasks.Task), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), - Parameters = new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = __CreateInstance, - InvokeTypedTest = __InvokeTest, - }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.Bugs._1924.None.Tests3.Test", - ClassName = "Tests3", - MethodName = "Test", - FullyQualifiedName = "TUnit.TestProject.Bugs._1924.None.Tests3.Test", - FilePath = @"", - LineNumber = 29, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 10, - DependsOn = global::System.Array.Empty(), - 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) +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static global::TUnit.TestProject.Bugs._1924.None.Tests3 __CreateInstance_0(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) + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.Bugs._1924.None.Tests3 instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -672,8 +378,48 @@ internal sealed class TUnit_TestProject_Bugs__1924_None_Tests3_Test__int_TestSou return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.ArgumentsAttribute(1), + new global::TUnit.Core.ArgumentsAttribute(2), + new global::TUnit.Core.ArgumentsAttribute(3), + new global::TUnit.Core.RepeatAttribute(10), + new global::TUnit.Core.InheritsTestsAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + }; + } + public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry + { + MethodName = "Test", + FullyQualifiedName = "TUnit.TestProject.Bugs._1924.None.Tests3.Test", + FilePath = @"", + LineNumber = 29, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 10, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(1), + new global::TUnit.Core.ArgumentsAttribute(2), + new global::TUnit.Core.ArgumentsAttribute(3), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__1924_None_Tests3_Test__int_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._1924.None.Tests3), new TUnit_TestProject_Bugs__1924_None_Tests3_Test__int_TestSource()); + static readonly int _r_TUnit_TestProject_Bugs__1924_None_Tests3_Test__int_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__1924_None_Tests3_Test__int_TestSource.Entries_0); } diff --git a/TUnit.Core.SourceGenerator.Tests/Issue2887Tests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Issue2887Tests.Test.verified.txt index 05679e8921..da957c0416 100644 --- a/TUnit.Core.SourceGenerator.Tests/Issue2887Tests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Issue2887Tests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,37 +7,67 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_Bugs__Issue2887_ActualTestClass__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._Issue2887.ActualTestClass", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._Issue2887.ActualTestClass", 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", "TestsBase`1"), - Parameters = new global::TUnit.Core.ParameterMetadata[] + global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Bugs._Issue2887.IServiceProvider), "serviceProvider", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._Issue2887.IServiceProvider)), false, reflectionInfoFactory: static () => 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._Issue2887.ActualTestClass); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Test1", __classType, typeof(void), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.Bugs._Issue2887.ActualTestClass instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) + { + case 0: { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Bugs._Issue2887.IServiceProvider), "serviceProvider", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._Issue2887.IServiceProvider)), false, reflectionInfoFactory: static () => 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 - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._Issue2887.ActualTestClass); - var metadata_Test1 = global::TUnit.Core.TestMetadataFactory.Create( - "Test1", "Test1", 26, - __InvokeTest_Test1, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test1", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_Test1 }; + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Attribute[] __Attributes(int groupIndex) { - yield return new global::TUnit.Core.TestDescriptor + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.ClassConstructorAttribute() + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } + } + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.Bugs._Issue2887.ActualTestClass.Test1", - ClassName = "ActualTestClass", MethodName = "Test1", FullyQualifiedName = "TUnit.TestProject.Bugs._Issue2887.ActualTestClass.Test1", FilePath = @"", @@ -47,61 +77,16 @@ internal static class TUnit_TestProject_Bugs__Issue2887_ActualTestClass__TestSou HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Test1 - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.ClassConstructorAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Test1(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test1(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._Issue2887.ActualTestClass", 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[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Bugs._Issue2887.IServiceProvider), "serviceProvider", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._Issue2887.IServiceProvider)), false, reflectionInfoFactory: static () => 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 - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._Issue2887.ActualTestClass); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Test1", "Test1", 26, - __InvokeTest_Test1, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test1", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal 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"); - } + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__Issue2887_ActualTestClass__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._Issue2887.ActualTestClass), TUnit_TestProject_Bugs__Issue2887_ActualTestClass__TestSource.GetTests, TUnit_TestProject_Bugs__Issue2887_ActualTestClass__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_Bugs__Issue2887_ActualTestClass__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__Issue2887_ActualTestClass__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/MatrixTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/MatrixTests.Test.verified.txt index 2527b9bcee..45b9daf41e 100644 --- a/TUnit.Core.SourceGenerator.Tests/MatrixTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/MatrixTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,210 +7,373 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_MatrixTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.MatrixTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_One", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[1]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_Two", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i2", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[1]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i3", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[2]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_Enum", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.TestEnum), "testEnum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TestEnum)), false, reflectionInfoFactory: static () => 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()[1]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.TestEnum?), "testEnum2", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TestEnum?)), true, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_3 = global::TUnit.Core.MethodMetadataFactory.Create("AutoGenerateBools", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_4 = global::TUnit.Core.MethodMetadataFactory.Create("AutoGenerateBools2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool?), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool?)), true, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_5 = global::TUnit.Core.MethodMetadataFactory.Create("ImplicitConversion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(OneOf), "enum", new global::TUnit.Core.ConcreteType(typeof(OneOf)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_6 = global::TUnit.Core.MethodMetadataFactory.Create("ExcludingAutoGeneratedMatrixValues", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), "enum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_7 = global::TUnit.Core.MethodMetadataFactory.Create("Method1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_8 = global::TUnit.Core.MethodMetadataFactory.Create("Method2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_9 = global::TUnit.Core.MethodMetadataFactory.Create("Method3", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_10 = global::TUnit.Core.MethodMetadataFactory.Create("Method4", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_11 = global::TUnit.Core.MethodMetadataFactory.Create("Exclusion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item2", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_12 = global::TUnit.Core.MethodMetadataFactory.Create("MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "flag", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), "enum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)), false, reflectionInfoFactory: static () => 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]) +}); + private static global::TUnit.TestProject.MatrixTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata_MatrixTest_One__string_int_bool = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixTest_One", "MatrixTest_One", 9, - __InvokeTest_MatrixTest_One__string_int_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_One", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_MatrixTest_Two__int_int_int_bool = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixTest_Two", "MatrixTest_Two", 19, - __InvokeTest_MatrixTest_Two__int_int_int_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_Two", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i2", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i3", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[2]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_MatrixTest_Enum__int_TestEnum_TestEnum_ = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixTest_Enum", "MatrixTest_Enum", 30, - __InvokeTest_MatrixTest_Enum__int_TestEnum_TestEnum_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_Enum", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.TestEnum), "testEnum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TestEnum)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.TestEnum?), "testEnum2", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TestEnum?)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_AutoGenerateBools__string_bool = global::TUnit.Core.TestMetadataFactory.Create( - "AutoGenerateBools", "AutoGenerateBools", 40, - __InvokeTest_AutoGenerateBools__string_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AutoGenerateBools", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_AutoGenerateBools2__string_bool_ = global::TUnit.Core.TestMetadataFactory.Create( - "AutoGenerateBools2", "AutoGenerateBools2", 49, - __InvokeTest_AutoGenerateBools2__string_bool_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AutoGenerateBools2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool?), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool?)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool = global::TUnit.Core.TestMetadataFactory.Create( - "ImplicitConversion", "ImplicitConversion", 58, - __InvokeTest_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ImplicitConversion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(OneOf), "enum", new global::TUnit.Core.ConcreteType(typeof(OneOf)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool = global::TUnit.Core.TestMetadataFactory.Create( - "ExcludingAutoGeneratedMatrixValues", "ExcludingAutoGeneratedMatrixValues", 67, - __InvokeTest_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ExcludingAutoGeneratedMatrixValues", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), "enum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_Method1__int = global::TUnit.Core.TestMetadataFactory.Create( - "Method1", "Method1", 116, - __InvokeTest_Method1__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Method1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_Method2__int = global::TUnit.Core.TestMetadataFactory.Create( - "Method2", "Method2", 124, - __InvokeTest_Method2__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Method2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_Method3__int = global::TUnit.Core.TestMetadataFactory.Create( - "Method3", "Method3", 132, - __InvokeTest_Method3__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Method3", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_Method4__int = global::TUnit.Core.TestMetadataFactory.Create( - "Method4", "Method4", 140, - __InvokeTest_Method4__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Method4", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_Exclusion__int_int = global::TUnit.Core.TestMetadataFactory.Create( - "Exclusion", "Exclusion", 148, - __InvokeTest_Exclusion__int_int, __CreateAttributes_1, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Exclusion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item2", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", 197, - __InvokeTest_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] + return new global::TUnit.TestProject.MatrixTests(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke(global::TUnit.TestProject.MatrixTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "flag", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), "enum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: + { + 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)); + } + } + case 3: + { + 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)); + } + } + case 4: + { + 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)); + } + } + case 5: + { + 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)); + } + } + case 6: + { + 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)); + } + } + case 7: + { + 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)); + } + } + case 8: + { + 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)); + } + } + case 9: + { + 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)); + } + } + case 10: + { + 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)); + } + } + case 11: + { + 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)); + } + } + case 12: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_MatrixTest_One__string_int_bool, metadata_MatrixTest_Two__int_int_int_bool, metadata_MatrixTest_Enum__int_TestEnum_TestEnum_, metadata_AutoGenerateBools__string_bool, metadata_AutoGenerateBools2__string_bool_, metadata_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool, metadata_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool, metadata_Method1__int, metadata_Method2__int, metadata_Method3__int, metadata_Method4__int, metadata_Exclusion__int_int, metadata_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + case 1: + { + 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) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.MatrixTest_One", - ClassName = "MatrixTests", MethodName = "MatrixTest_One", FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_One", FilePath = @"", @@ -220,12 +383,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_MatrixTest_One__string_int_bool - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.MatrixTest_Two", - ClassName = "MatrixTests", MethodName = "MatrixTest_Two", FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_Two", FilePath = @"", @@ -235,12 +405,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_MatrixTest_Two__int_int_int_bool - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.MatrixTest_Enum", - ClassName = "MatrixTests", MethodName = "MatrixTest_Enum", FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_Enum", FilePath = @"", @@ -250,12 +427,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_MatrixTest_Enum__int_TestEnum_TestEnum_ - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.AutoGenerateBools", - ClassName = "MatrixTests", MethodName = "AutoGenerateBools", FullyQualifiedName = "TUnit.TestProject.MatrixTests.AutoGenerateBools", FilePath = @"", @@ -265,12 +449,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_AutoGenerateBools__string_bool - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_3, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 3, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.AutoGenerateBools2", - ClassName = "MatrixTests", MethodName = "AutoGenerateBools2", FullyQualifiedName = "TUnit.TestProject.MatrixTests.AutoGenerateBools2", FilePath = @"", @@ -280,12 +471,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_AutoGenerateBools2__string_bool_ - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_4, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 4, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.ImplicitConversion", - ClassName = "MatrixTests", MethodName = "ImplicitConversion", FullyQualifiedName = "TUnit.TestProject.MatrixTests.ImplicitConversion", FilePath = @"", @@ -295,12 +493,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_5, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 5, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.ExcludingAutoGeneratedMatrixValues", - ClassName = "MatrixTests", MethodName = "ExcludingAutoGeneratedMatrixValues", FullyQualifiedName = "TUnit.TestProject.MatrixTests.ExcludingAutoGeneratedMatrixValues", FilePath = @"", @@ -310,12 +515,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_6, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 6, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.Method1", - ClassName = "MatrixTests", MethodName = "Method1", FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method1", FilePath = @"", @@ -325,12 +537,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Method1__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_7, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 7, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.Method2", - ClassName = "MatrixTests", MethodName = "Method2", FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method2", FilePath = @"", @@ -340,12 +559,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Method2__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_8, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 8, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.Method3", - ClassName = "MatrixTests", MethodName = "Method3", FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method3", FilePath = @"", @@ -355,12 +581,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Method3__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_9, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 9, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.Method4", - ClassName = "MatrixTests", MethodName = "Method4", FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method4", FilePath = @"", @@ -370,12 +603,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Method4__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_10, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 10, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.Exclusion", - ClassName = "MatrixTests", MethodName = "Exclusion", FullyQualifiedName = "TUnit.TestProject.MatrixTests.Exclusion", FilePath = @"", @@ -385,12 +625,19 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Exclusion__int_int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_11, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 11, + CreateAttributes = __Attributes, + AttributeGroupIndex = 1, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MatrixTests.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", - ClassName = "MatrixTests", MethodName = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", FilePath = @"", @@ -400,671 +647,20 @@ internal static class TUnit_TestProject_MatrixTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Attribute[] __CreateAttributes_1() - { - 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::System.Threading.Tasks.ValueTask __InvokeTest_MatrixTest_One__string_int_bool(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_MatrixTest_Two__int_int_int_bool(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_MatrixTest_Enum__int_TestEnum_TestEnum_(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_AutoGenerateBools__string_bool(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_AutoGenerateBools2__string_bool_(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Method1__int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Method2__int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Method3__int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Method4__int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Exclusion__int_int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_MatrixTest_One__string_int_bool(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixTest_One", "MatrixTest_One", 9, - __InvokeTest_MatrixTest_One__string_int_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_One", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_MatrixTest_Two__int_int_int_bool(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixTest_Two", "MatrixTest_Two", 19, - __InvokeTest_MatrixTest_Two__int_int_int_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_Two", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i2", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i3", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[2]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_MatrixTest_Enum__int_TestEnum_TestEnum_(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixTest_Enum", "MatrixTest_Enum", 30, - __InvokeTest_MatrixTest_Enum__int_TestEnum_TestEnum_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest_Enum", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.TestEnum), "testEnum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TestEnum)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.TestEnum?), "testEnum2", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TestEnum?)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_AutoGenerateBools__string_bool(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "AutoGenerateBools", "AutoGenerateBools", 40, - __InvokeTest_AutoGenerateBools__string_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AutoGenerateBools", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_AutoGenerateBools2__string_bool_(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "AutoGenerateBools2", "AutoGenerateBools2", 49, - __InvokeTest_AutoGenerateBools2__string_bool_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("AutoGenerateBools2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "str", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool?), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool?)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "ImplicitConversion", "ImplicitConversion", 58, - __InvokeTest_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ImplicitConversion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(OneOf), "enum", new global::TUnit.Core.ConcreteType(typeof(OneOf)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "ExcludingAutoGeneratedMatrixValues", "ExcludingAutoGeneratedMatrixValues", 67, - __InvokeTest_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ExcludingAutoGeneratedMatrixValues", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), "enum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "boolean", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Method1__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Method1", "Method1", 116, - __InvokeTest_Method1__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Method1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Method2__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Method2", "Method2", 124, - __InvokeTest_Method2__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Method2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Method3__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Method3", "Method3", 132, - __InvokeTest_Method3__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Method3", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Method4__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Method4", "Method4", 140, - __InvokeTest_Method4__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Method4", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Exclusion__int_int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Exclusion", "Exclusion", 148, - __InvokeTest_Exclusion__int_int, __CreateAttributes_1, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Exclusion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "item2", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MatrixTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", 197, - __InvokeTest_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "flag", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), "enum", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.MatrixTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MatrixTests(); - } + MethodMetadata = __mm_12, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 12, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_MatrixTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.MatrixTests), TUnit_TestProject_MatrixTests__TestSource.GetTests, TUnit_TestProject_MatrixTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_MatrixTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_MatrixTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenTests.Test.verified.txt index f03011c053..ac4577bef9 100644 --- a/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,263 +7,217 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_MethodDataSourceDrivenTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method2", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method_WithAction", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Action), "action", new global::TUnit.Core.ConcreteType(typeof(global::System.Action)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_3 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method3", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_4 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method4", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_5 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_WithBaseReturn", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue), "value", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_6 = global::TUnit.Core.MethodMetadataFactory.Create("EnumerableFuncArrayTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string[]), "strings", new global::TUnit.Core.ConcreteType(typeof(string[])), false, reflectionInfoFactory: static () => 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]) +}); + private static global::TUnit.TestProject.MethodDataSourceDrivenTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var metadata_DataSource_Method__int = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method", "DataSource_Method", 12, - __InvokeTest_DataSource_Method__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") + case 0: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + 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}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - var metadata_DataSource_Method2__int = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method2", "DataSource_Method2", 19, - __InvokeTest_DataSource_Method2__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method2", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Factory = (dataGeneratorMetadata) => + catch (global::System.Exception ex) { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } - }, - }, - testSessionId: testSessionId - ); - var metadata_DataSource_Method_WithAction__Action = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method_WithAction", "DataSource_Method_WithAction", 26, - __InvokeTest_DataSource_Method_WithAction__Action, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method_WithAction", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Action), "action", new global::TUnit.Core.ConcreteType(typeof(global::System.Action)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("SomeAction") + } + case 1: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeAction(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + 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}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - var metadata_DataSource_Method3__int = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method3", "DataSource_Method3", 33, - __InvokeTest_DataSource_Method3__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method3", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Factory = (dataGeneratorMetadata) => + catch (global::System.Exception ex) { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } - }, - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") + } + case 2: { - Arguments = new object[] { 5 }, - Factory = (dataGeneratorMetadata) => + try { - // Capture Arguments from the attribute - var arguments = new object[] { 5 }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + 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}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - var metadata_DataSource_Method4__int = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method4", "DataSource_Method4", 42, - __InvokeTest_DataSource_Method4__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method4", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Factory = (dataGeneratorMetadata) => + catch (global::System.Exception ex) { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } - }, - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") + } + case 3: { - Arguments = new object[] { "Hello World!", 6, true }, - Factory = (dataGeneratorMetadata) => + try { - // Capture Arguments from the attribute - var arguments = new object[] { "Hello World!", 6, true }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + 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}"); } - return Factory(); } - }, - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Factory = (dataGeneratorMetadata) => + catch (global::System.Exception ex) { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } - }, - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") + } + case 4: { - Arguments = new object[] { "Hello World!", 8, true }, - Factory = (dataGeneratorMetadata) => + try { - // Capture Arguments from the attribute - var arguments = new object[] { "Hello World!", 8, true }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + 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}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - var metadata_DataSource_WithBaseReturn__BaseValue = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_WithBaseReturn", "DataSource_WithBaseReturn", 53, - __InvokeTest_DataSource_WithBaseReturn__BaseValue, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_WithBaseReturn", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue), "value", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("MethodWithBaseReturn") + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + case 5: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.MethodWithBaseReturn(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + 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}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - var metadata_EnumerableFuncArrayTest__string__ = global::TUnit.Core.TestMetadataFactory.Create( - "EnumerableFuncArrayTest", "EnumerableFuncArrayTest", 59, - __InvokeTest_EnumerableFuncArrayTest__string__, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("EnumerableFuncArrayTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string[]), "strings", new global::TUnit.Core.ConcreteType(typeof(string[])), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("EnumerableFuncArrayTestData") + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + case 6: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTestData(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) + case 1: { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + return new global::System.Threading.Tasks.ValueTask(instance.EnumerableFuncArrayTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_DataSource_Method__int, metadata_DataSource_Method2__int, metadata_DataSource_Method_WithAction__Action, metadata_DataSource_Method3__int, metadata_DataSource_Method4__int, metadata_DataSource_WithBaseReturn__BaseValue, metadata_EnumerableFuncArrayTest__string__ }; + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Attribute[] __Attributes(int groupIndex) { - yield return new global::TUnit.Core.TestDescriptor + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } + } + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method", - ClassName = "MethodDataSourceDrivenTests", MethodName = "DataSource_Method", FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method", FilePath = @"", @@ -273,12 +227,30 @@ internal static class TUnit_TestProject_MethodDataSourceDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_Method__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") + { + Factory = (dataGeneratorMetadata) => + { + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + { + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } + return Factory(); + } + }, +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method2", - ClassName = "MethodDataSourceDrivenTests", MethodName = "DataSource_Method2", FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method2", FilePath = @"", @@ -288,12 +260,30 @@ internal static class TUnit_TestProject_MethodDataSourceDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_Method2__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") + { + Factory = (dataGeneratorMetadata) => + { + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + { + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } + return Factory(); + } + }, +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method_WithAction", - ClassName = "MethodDataSourceDrivenTests", MethodName = "DataSource_Method_WithAction", FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method_WithAction", FilePath = @"", @@ -303,12 +293,30 @@ internal static class TUnit_TestProject_MethodDataSourceDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_Method_WithAction__Action - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("SomeAction") + { + Factory = (dataGeneratorMetadata) => + { + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + { + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeAction(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } + return Factory(); + } + }, +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method3", - ClassName = "MethodDataSourceDrivenTests", MethodName = "DataSource_Method3", FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method3", FilePath = @"", @@ -318,554 +326,197 @@ internal static class TUnit_TestProject_MethodDataSourceDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_Method3__int - }; - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method4", - ClassName = "MethodDataSourceDrivenTests", - MethodName = "DataSource_Method4", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method4", - FilePath = @"", - LineNumber = 42, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_Method4__int - }; - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_WithBaseReturn", - ClassName = "MethodDataSourceDrivenTests", - MethodName = "DataSource_WithBaseReturn", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_WithBaseReturn", - FilePath = @"", - LineNumber = 53, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_WithBaseReturn__BaseValue - }; - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTest", - ClassName = "MethodDataSourceDrivenTests", - MethodName = "EnumerableFuncArrayTest", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTest", - FilePath = @"", - LineNumber = 59, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_EnumerableFuncArrayTest__string__ - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method__int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method2__int(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + MethodMetadata = __mm_3, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 3, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - try + Factory = (dataGeneratorMetadata) => { - switch (args.Length) + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - 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}"); + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } + return Factory(); } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method_WithAction__Action(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + }, + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - try + Arguments = new object[] { 5 }, + Factory = (dataGeneratorMetadata) => { - switch (args.Length) + // Capture Arguments from the attribute + var arguments = new object[] { 5 }; + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - 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}"); + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } + return Factory(); } - catch (global::System.Exception ex) + }, +}, + }, + new global::TUnit.Core.TestEntry { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method3__int(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + MethodName = "DataSource_Method4", + FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method4", + FilePath = @"", + LineNumber = 42, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_4, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 4, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - try + Factory = (dataGeneratorMetadata) => { - switch (args.Length) + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - 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}"); + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } + return Factory(); } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method4__int(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + }, + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - try + Arguments = new object[] { "Hello World!", 6, true }, + Factory = (dataGeneratorMetadata) => { - switch (args.Length) + // Capture Arguments from the attribute + var arguments = new object[] { "Hello World!", 6, true }; + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - 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}"); + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } + return Factory(); } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_WithBaseReturn__BaseValue(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + }, + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - try + Factory = (dataGeneratorMetadata) => { - switch (args.Length) + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - 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}"); + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } + return Factory(); } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_EnumerableFuncArrayTest__string__(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + }, + new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") { - try + Arguments = new object[] { "Hello World!", 8, true }, + Factory = (dataGeneratorMetadata) => { - switch (args.Length) + // Capture Arguments from the attribute + var arguments = new object[] { "Hello World!", 8, true }; + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - 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}"); + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } + return Factory(); } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method", "DataSource_Method", 12, - __InvokeTest_DataSource_Method__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method2__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method2", "DataSource_Method2", 19, - __InvokeTest_DataSource_Method2__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method2", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } +}, }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method_WithAction__Action(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata + new global::TUnit.Core.TestEntry { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method_WithAction", "DataSource_Method_WithAction", 26, - __InvokeTest_DataSource_Method_WithAction__Action, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method_WithAction", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Action), "action", new global::TUnit.Core.ConcreteType(typeof(global::System.Action)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + MethodName = "DataSource_WithBaseReturn", + FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_WithBaseReturn", + FilePath = @"", + LineNumber = 53, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_5, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 5, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("MethodWithBaseReturn") { - new global::TUnit.Core.MethodDataSourceAttribute("SomeAction") + Factory = (dataGeneratorMetadata) => { - Factory = (dataGeneratorMetadata) => + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeAction(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.MethodWithBaseReturn(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } - }, + return Factory(); + } }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method3__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method3", "DataSource_Method3", 33, - __InvokeTest_DataSource_Method3__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method3", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Arguments = new object[] { 5 }, - Factory = (dataGeneratorMetadata) => - { - // Capture Arguments from the attribute - var arguments = new object[] { 5 }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } +}, }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method4__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata + new global::TUnit.Core.TestEntry { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_Method4", "DataSource_Method4", 42, - __InvokeTest_DataSource_Method4__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_Method4", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + MethodName = "EnumerableFuncArrayTest", + FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTest", + FilePath = @"", + LineNumber = 59, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_6, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 6, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("EnumerableFuncArrayTestData") { - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Arguments = new object[] { "Hello World!", 6, true }, - Factory = (dataGeneratorMetadata) => - { - // Capture Arguments from the attribute - var arguments = new object[] { "Hello World!", 6, true }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") + Factory = (dataGeneratorMetadata) => { - Factory = (dataGeneratorMetadata) => + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTestData(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, - new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") - { - Arguments = new object[] { "Hello World!", 8, true }, - Factory = (dataGeneratorMetadata) => - { - // Capture Arguments from the attribute - var arguments = new object[] { "Hello World!", 8, true }; - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.SomeMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + foreach (var item in enumerable) + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + } } - return Factory(); - } - }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_WithBaseReturn__BaseValue(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_WithBaseReturn", "DataSource_WithBaseReturn", 53, - __InvokeTest_DataSource_WithBaseReturn__BaseValue, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_WithBaseReturn", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue), "value", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("MethodWithBaseReturn") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + else { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.MethodWithBaseReturn(); yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } - return Factory(); } - }, + return Factory(); + } }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_EnumerableFuncArrayTest__string__(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "EnumerableFuncArrayTest", "EnumerableFuncArrayTest", 59, - __InvokeTest_EnumerableFuncArrayTest__string__, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("EnumerableFuncArrayTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string[]), "strings", new global::TUnit.Core.ConcreteType(typeof(string[])), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("EnumerableFuncArrayTestData") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenTests.EnumerableFuncArrayTestData(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } +}, }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.MethodDataSourceDrivenTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MethodDataSourceDrivenTests(); - } + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_MethodDataSourceDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TUnit_TestProject_MethodDataSourceDrivenTests__TestSource.GetTests, TUnit_TestProject_MethodDataSourceDrivenTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_MethodDataSourceDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_MethodDataSourceDrivenTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenWithCancellationTokenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenWithCancellationTokenTests.Test.verified.txt index 9dd1c6d72b..5f4068232e 100644 --- a/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenWithCancellationTokenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenWithCancellationTokenTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,153 +7,77 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_MethodDataSourceDrivenWithCancellationTokenTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests); - var metadata_MyTest__int_CancellationToken = global::TUnit.Core.TestMetadataFactory.Create( - "MyTest", "MyTest", 12, - __InvokeTest_MyTest__int_CancellationToken, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MyTest", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Threading.CancellationToken), "cancellationToken", new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("MyTest", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Threading.CancellationToken), "cancellationToken", new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), false, reflectionInfoFactory: static () => 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]) +}); + 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 __Invoke(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - new global::TUnit.Core.MethodDataSourceAttribute("T") + case 0: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + var context = global::TUnit.Core.TestContext.Current; + switch (args.Length) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.T(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, - new global::TUnit.Core.MethodDataSourceAttribute("FuncT") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.FuncT(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, - new global::TUnit.Core.MethodDataSourceAttribute("EnumerableT") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.EnumerableT(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) + case 1: { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + 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); } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); } - return Factory(); } - }, - new global::TUnit.Core.MethodDataSourceAttribute("EnumerableFuncT") - { - Factory = (dataGeneratorMetadata) => + catch (global::System.Exception ex) { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.EnumerableFuncT(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } - }, - new global::TUnit.Core.MethodDataSourceAttribute("ArrayT") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.ArrayT(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } - }, - new global::TUnit.Core.MethodDataSourceAttribute("ArrayFuncT") + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) + { + case 0: { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.ArrayFuncT(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } - }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_MyTest__int_CancellationToken }; + 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 ``") + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.MyTest", - ClassName = "MethodDataSourceDrivenWithCancellationTokenTests", MethodName = "MyTest", FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.MyTest", FilePath = @"", @@ -163,186 +87,131 @@ internal static class TUnit_TestProject_MethodDataSourceDrivenWithCancellationTo HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_MyTest__int_CancellationToken - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - 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::System.Threading.Tasks.ValueTask __InvokeTest_MyTest__int_CancellationToken(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("T") { - try + Factory = (dataGeneratorMetadata) => { - var context = global::TUnit.Core.TestContext.Current; - switch (args.Length) + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - 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}"); + var result = global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.T(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } + return Factory(); } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_MyTest__int_CancellationToken(string testSessionId) + }, + new global::TUnit.Core.MethodDataSourceAttribute("FuncT") { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests", new global::TUnit.Core.ClassMetadata + Factory = (dataGeneratorMetadata) => { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "MyTest", "MyTest", 12, - __InvokeTest_MyTest__int_CancellationToken, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MyTest", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Threading.CancellationToken), "cancellationToken", new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + { + var result = global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.FuncT(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } + return Factory(); + } + }, + new global::TUnit.Core.MethodDataSourceAttribute("EnumerableT") { - new global::TUnit.Core.MethodDataSourceAttribute("T") + Factory = (dataGeneratorMetadata) => { - Factory = (dataGeneratorMetadata) => + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + var result = global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.EnumerableT(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.T(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + foreach (var item in enumerable) + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + } } - return Factory(); - } - }, - new global::TUnit.Core.MethodDataSourceAttribute("FuncT") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + else { - var result = global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.FuncT(); yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } - return Factory(); } - }, - new global::TUnit.Core.MethodDataSourceAttribute("EnumerableT") + return Factory(); + } + }, + new global::TUnit.Core.MethodDataSourceAttribute("EnumerableFuncT") + { + Factory = (dataGeneratorMetadata) => { - Factory = (dataGeneratorMetadata) => + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + var result = global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.EnumerableFuncT(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.EnumerableT(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) + foreach (var item in enumerable) { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); } } - return Factory(); - } - }, - new global::TUnit.Core.MethodDataSourceAttribute("EnumerableFuncT") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + else { - var result = global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.EnumerableFuncT(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } - return Factory(); } - }, - new global::TUnit.Core.MethodDataSourceAttribute("ArrayT") + return Factory(); + } + }, + new global::TUnit.Core.MethodDataSourceAttribute("ArrayT") + { + Factory = (dataGeneratorMetadata) => { - Factory = (dataGeneratorMetadata) => + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + var result = global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.ArrayT(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.ArrayT(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else + foreach (var item in enumerable) { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); } } - return Factory(); + else + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } } - }, - new global::TUnit.Core.MethodDataSourceAttribute("ArrayFuncT") + return Factory(); + } + }, + new global::TUnit.Core.MethodDataSourceAttribute("ArrayFuncT") + { + Factory = (dataGeneratorMetadata) => { - Factory = (dataGeneratorMetadata) => + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + var result = global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.ArrayFuncT(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) { - var result = global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests.ArrayFuncT(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else + foreach (var item in enumerable) { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); } } - return Factory(); + else + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } } - }, + return Factory(); + } }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests(); - } +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_MethodDataSourceDrivenWithCancellationTokenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests), TUnit_TestProject_MethodDataSourceDrivenWithCancellationTokenTests__TestSource.GetTests, TUnit_TestProject_MethodDataSourceDrivenWithCancellationTokenTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_MethodDataSourceDrivenWithCancellationTokenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_MethodDataSourceDrivenWithCancellationTokenTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/MultipleClassDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/MultipleClassDataSourceDrivenTests.Test.verified.txt index ba4a6878df..9e8ed32aa1 100644 --- a/TUnit.Core.SourceGenerator.Tests/MultipleClassDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/MultipleClassDataSourceDrivenTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,57 +7,85 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_MultipleClassDataSourceDrivenTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MultipleClassDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MultipleClassDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1), "inject1", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1)), false, reflectionInfoFactory: static () => 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]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2), "inject2", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2)), false, reflectionInfoFactory: static () => 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]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3), "inject3", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3)), false, reflectionInfoFactory: static () => 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]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4), "inject4", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4)), false, reflectionInfoFactory: static () => 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]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5), "inject5", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5)), false, reflectionInfoFactory: static () => 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 - }); - var __classType = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests); - var metadata_Test1 = global::TUnit.Core.TestMetadataFactory.Create( - "Test1", "Test1", 17, - __InvokeTest_Test1, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test1", __classType, typeof(void), __classMetadata), - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - 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},}, + global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1), "inject1", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1)), false, reflectionInfoFactory: static () => 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]), + global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2), "inject2", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2)), false, reflectionInfoFactory: static () => 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]), + global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3), "inject3", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3)), false, reflectionInfoFactory: static () => 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]), + global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4), "inject4", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4)), false, reflectionInfoFactory: static () => 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]), + global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5), "inject5", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5)), false, reflectionInfoFactory: static () => 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]) }, - testSessionId: testSessionId - ); - var metadata_Test2 = global::TUnit.Core.TestMetadataFactory.Create( - "Test2", "Test2", 23, - __InvokeTest_Test2, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test2", __classType, typeof(void), __classMetadata), - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Test1", __classType, typeof(void), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("Test2", __classType, typeof(void), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - 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},}, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_Test1, metadata_Test2 }; + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) + { + case 0: + { + 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},} + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MultipleClassDataSourceDrivenTests.Test1", - ClassName = "MultipleClassDataSourceDrivenTests", MethodName = "Test1", FullyQualifiedName = "TUnit.TestProject.MultipleClassDataSourceDrivenTests.Test1", FilePath = @"", @@ -67,12 +95,20 @@ internal static class TUnit_TestProject_MultipleClassDataSourceDrivenTests__Test HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Test1 - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + 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},}, +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.MultipleClassDataSourceDrivenTests.Test2", - ClassName = "MultipleClassDataSourceDrivenTests", MethodName = "Test2", FullyQualifiedName = "TUnit.TestProject.MultipleClassDataSourceDrivenTests.Test2", FilePath = @"", @@ -82,117 +118,21 @@ internal static class TUnit_TestProject_MultipleClassDataSourceDrivenTests__Test HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Test2 - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - 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::System.Threading.Tasks.ValueTask __InvokeTest_Test1(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Test2(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test1(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MultipleClassDataSourceDrivenTests", 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[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1), "inject1", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1)), false, reflectionInfoFactory: static () => 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]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2), "inject2", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2)), false, reflectionInfoFactory: static () => 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]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3), "inject3", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3)), false, reflectionInfoFactory: static () => 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]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4), "inject4", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4)), false, reflectionInfoFactory: static () => 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]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5), "inject5", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5)), false, reflectionInfoFactory: static () => 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 - }); - var __classType = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Test1", "Test1", 17, - __InvokeTest_Test1, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test1", __classType, typeof(void), __classMetadata), - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - 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},}, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test2(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MultipleClassDataSourceDrivenTests", 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[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1), "inject1", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1)), false, reflectionInfoFactory: static () => 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]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2), "inject2", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2)), false, reflectionInfoFactory: static () => 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]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3), "inject3", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3)), false, reflectionInfoFactory: static () => 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]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4), "inject4", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4)), false, reflectionInfoFactory: static () => 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]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5), "inject5", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5)), false, reflectionInfoFactory: static () => 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 - }); - var __classType = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Test2", "Test2", 23, - __InvokeTest_Test2, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test2", __classType, typeof(void), __classMetadata), - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - 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},}, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal 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])); - } + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + 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},}, +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_MultipleClassDataSourceDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests), TUnit_TestProject_MultipleClassDataSourceDrivenTests__TestSource.GetTests, TUnit_TestProject_MultipleClassDataSourceDrivenTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_MultipleClassDataSourceDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_MultipleClassDataSourceDrivenTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/NameOfArgumentTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/NameOfArgumentTests.Test.verified.txt index 48a66789e8..a56494e952 100644 --- a/TUnit.Core.SourceGenerator.Tests/NameOfArgumentTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/NameOfArgumentTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,115 +7,96 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_NameOfArgumentTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NameOfArgumentTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NameOfArgumentTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.NameOfArgumentTests); - var metadata_TestName__string = global::TUnit.Core.TestMetadataFactory.Create( - "TestName", "TestName", 8, - __InvokeTest_TestName__string, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("TestName", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "name", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("TestName"), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_TestName__string }; - } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.NameOfArgumentTests.TestName", - ClassName = "NameOfArgumentTests", - MethodName = "TestName", - FullyQualifiedName = "TUnit.TestProject.NameOfArgumentTests.TestName", - FilePath = @"", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_TestName__string - }; - } - private static global::System.Attribute[] __CreateAttributes_0() + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.NameOfArgumentTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("TestName", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "name", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) +}); + private static global::TUnit.TestProject.NameOfArgumentTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; + return new global::TUnit.TestProject.NameOfArgumentTests(); } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_TestName__string(global::TUnit.TestProject.NameOfArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __Invoke(global::TUnit.TestProject.NameOfArgumentTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) { - try + switch (methodIndex) { - switch (args.Length) + case 0: { - case 1: + try + { + switch (args.Length) { - return new global::System.Threading.Tasks.ValueTask(instance.TestName(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + 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}"); } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); } } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_TestName__string(string testSessionId) + private static global::System.Attribute[] __Attributes(int groupIndex) { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NameOfArgumentTests", new global::TUnit.Core.ClassMetadata + switch (groupIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.NameOfArgumentTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "TestName", "TestName", 8, - __InvokeTest_TestName__string, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("TestName", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "name", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("TestName"), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - internal static global::TUnit.TestProject.NameOfArgumentTests CreateInstance(global::System.Type[] typeArgs, object?[] args) + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - return new global::TUnit.TestProject.NameOfArgumentTests(); - } + new global::TUnit.Core.TestEntry + { + MethodName = "TestName", + FullyQualifiedName = "TUnit.TestProject.NameOfArgumentTests.TestName", + FilePath = @"", + LineNumber = 8, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute("TestName"), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_NameOfArgumentTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.NameOfArgumentTests), TUnit_TestProject_NameOfArgumentTests__TestSource.GetTests, TUnit_TestProject_NameOfArgumentTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_NameOfArgumentTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_NameOfArgumentTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/NullableByteArgumentTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/NullableByteArgumentTests.Test.verified.txt index bb4b7fcf1c..c22659d4d3 100644 --- a/TUnit.Core.SourceGenerator.Tests/NullableByteArgumentTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/NullableByteArgumentTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,57 +7,99 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_NullableByteArgumentTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NullableByteArgumentTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NullableByteArgumentTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.NullableByteArgumentTests); - var metadata_Test__byte_ = global::TUnit.Core.TestMetadataFactory.Create( - "Test", "Test", 8, - __InvokeTest_Test__byte_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(byte?), "someByte", new global::TUnit.Core.ConcreteType(typeof(byte?)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute((byte) 1), - new global::TUnit.Core.ArgumentsAttribute(null), - }, - testSessionId: testSessionId - ); - var metadata_Test2__byte_byte_ = global::TUnit.Core.TestMetadataFactory.Create( - "Test2", "Test2", 15, - __InvokeTest_Test2__byte_byte_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test2", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.NullableByteArgumentTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Test", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(byte?), "someByte", new global::TUnit.Core.ConcreteType(typeof(byte?)), true, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("Test2", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(byte), "byte1", new global::TUnit.Core.ConcreteType(typeof(byte)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(byte?), "byte2", new global::TUnit.Core.ConcreteType(typeof(byte?)), true, reflectionInfoFactory: static () => 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]) +}); + 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 __Invoke(global::TUnit.TestProject.NullableByteArgumentTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(byte), "byte1", new global::TUnit.Core.ConcreteType(typeof(byte)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(byte?), "byte2", new global::TUnit.Core.ConcreteType(typeof(byte?)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - new global::TUnit.Core.ArgumentsAttribute((byte) 1, (byte) 1), - new global::TUnit.Core.ArgumentsAttribute((byte) 1, null), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_Test__byte_, metadata_Test2__byte_byte_ }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.NullableByteArgumentTests.Test", - ClassName = "NullableByteArgumentTests", MethodName = "Test", FullyQualifiedName = "TUnit.TestProject.NullableByteArgumentTests.Test", FilePath = @"", @@ -67,12 +109,20 @@ internal static class TUnit_TestProject_NullableByteArgumentTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Test__byte_ - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute((byte) 1), + new global::TUnit.Core.ArgumentsAttribute(null), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.NullableByteArgumentTests.Test2", - ClassName = "NullableByteArgumentTests", MethodName = "Test2", FullyQualifiedName = "TUnit.TestProject.NullableByteArgumentTests.Test2", FilePath = @"", @@ -82,124 +132,21 @@ internal static class TUnit_TestProject_NullableByteArgumentTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Test2__byte_byte_ - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Test__byte_(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Test2__byte_byte_(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test__byte_(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NullableByteArgumentTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.NullableByteArgumentTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Test", "Test", 8, - __InvokeTest_Test__byte_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(byte?), "someByte", new global::TUnit.Core.ConcreteType(typeof(byte?)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute((byte) 1), - new global::TUnit.Core.ArgumentsAttribute(null), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test2__byte_byte_(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NullableByteArgumentTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.NullableByteArgumentTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Test2", "Test2", 15, - __InvokeTest_Test2__byte_byte_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test2", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(byte), "byte1", new global::TUnit.Core.ConcreteType(typeof(byte)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(byte?), "byte2", new global::TUnit.Core.ConcreteType(typeof(byte?)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute((byte) 1, (byte) 1), - new global::TUnit.Core.ArgumentsAttribute((byte) 1, null), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.NullableByteArgumentTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.NullableByteArgumentTests(); - } + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute((byte) 1, (byte) 1), + new global::TUnit.Core.ArgumentsAttribute((byte) 1, null), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_NullableByteArgumentTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.NullableByteArgumentTests), TUnit_TestProject_NullableByteArgumentTests__TestSource.GetTests, TUnit_TestProject_NullableByteArgumentTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_NullableByteArgumentTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_NullableByteArgumentTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.Test.verified.txt index 724bfb39e3..9e1952e894 100644 --- a/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,106 +7,194 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_NumberArgumentTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.NumberArgumentTests); - var metadata_Int__int = global::TUnit.Core.TestMetadataFactory.Create( - "Int", "Int", 8, - __InvokeTest_Int__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Int", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1), - }, - testSessionId: testSessionId - ); - var metadata_Double__double = global::TUnit.Core.TestMetadataFactory.Create( - "Double", "Double", 15, - __InvokeTest_Double__double, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Double", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(double), "d", new global::TUnit.Core.ConcreteType(typeof(double)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1.1), - }, - testSessionId: testSessionId - ); - var metadata_Float__float = global::TUnit.Core.TestMetadataFactory.Create( - "Float", "Float", 22, - __InvokeTest_Float__float, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Float", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(float), "f", new global::TUnit.Core.ConcreteType(typeof(float)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1.1f), - }, - testSessionId: testSessionId - ); - var metadata_Long__long = global::TUnit.Core.TestMetadataFactory.Create( - "Long", "Long", 29, - __InvokeTest_Long__long, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Long", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(long), "l", new global::TUnit.Core.ConcreteType(typeof(long)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1L), - }, - testSessionId: testSessionId - ); - var metadata_ULong__ulong = global::TUnit.Core.TestMetadataFactory.Create( - "ULong", "ULong", 36, - __InvokeTest_ULong__ulong, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ULong", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(ulong), "l", new global::TUnit.Core.ConcreteType(typeof(ulong)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1UL), - }, - testSessionId: testSessionId - ); - var metadata_UInt__uint = global::TUnit.Core.TestMetadataFactory.Create( - "UInt", "UInt", 43, - __InvokeTest_UInt__uint, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("UInt", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.NumberArgumentTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Int", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("Double", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(double), "d", new global::TUnit.Core.ConcreteType(typeof(double)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("Float", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(float), "f", new global::TUnit.Core.ConcreteType(typeof(float)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_3 = global::TUnit.Core.MethodMetadataFactory.Create("Long", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(long), "l", new global::TUnit.Core.ConcreteType(typeof(long)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_4 = global::TUnit.Core.MethodMetadataFactory.Create("ULong", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(ulong), "l", new global::TUnit.Core.ConcreteType(typeof(ulong)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_5 = global::TUnit.Core.MethodMetadataFactory.Create("UInt", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(uint), "i", new global::TUnit.Core.ConcreteType(typeof(uint)), false, reflectionInfoFactory: static () => 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]) +}); + 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 __Invoke(global::TUnit.TestProject.NumberArgumentTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(uint), "i", new global::TUnit.Core.ConcreteType(typeof(uint)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: + { + 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)); + } + } + case 3: + { + 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)); + } + } + case 4: + { + 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)); + } + } + case 5: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - new global::TUnit.Core.ArgumentsAttribute(1U), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_Int__int, metadata_Double__double, metadata_Float__float, metadata_Long__long, metadata_ULong__ulong, metadata_UInt__uint }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.NumberArgumentTests.Int", - ClassName = "NumberArgumentTests", MethodName = "Int", FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.Int", FilePath = @"", @@ -116,12 +204,19 @@ internal static class TUnit_TestProject_NumberArgumentTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Int__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(1), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.NumberArgumentTests.Double", - ClassName = "NumberArgumentTests", MethodName = "Double", FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.Double", FilePath = @"", @@ -131,12 +226,19 @@ internal static class TUnit_TestProject_NumberArgumentTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Double__double - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(1.1), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.NumberArgumentTests.Float", - ClassName = "NumberArgumentTests", MethodName = "Float", FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.Float", FilePath = @"", @@ -146,12 +248,19 @@ internal static class TUnit_TestProject_NumberArgumentTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Float__float - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(1.1f), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.NumberArgumentTests.Long", - ClassName = "NumberArgumentTests", MethodName = "Long", FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.Long", FilePath = @"", @@ -161,12 +270,19 @@ internal static class TUnit_TestProject_NumberArgumentTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Long__long - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_3, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 3, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(1L), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.NumberArgumentTests.ULong", - ClassName = "NumberArgumentTests", MethodName = "ULong", FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.ULong", FilePath = @"", @@ -176,12 +292,19 @@ internal static class TUnit_TestProject_NumberArgumentTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_ULong__ulong - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_4, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 4, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(1UL), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.NumberArgumentTests.UInt", - ClassName = "NumberArgumentTests", MethodName = "UInt", FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.UInt", FilePath = @"", @@ -191,317 +314,20 @@ internal static class TUnit_TestProject_NumberArgumentTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_UInt__uint - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Int__int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Double__double(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Float__float(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Long__long(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_ULong__ulong(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_UInt__uint(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Int__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.NumberArgumentTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Int", "Int", 8, - __InvokeTest_Int__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Int", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Double__double(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.NumberArgumentTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Double", "Double", 15, - __InvokeTest_Double__double, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Double", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(double), "d", new global::TUnit.Core.ConcreteType(typeof(double)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1.1), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Float__float(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.NumberArgumentTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Float", "Float", 22, - __InvokeTest_Float__float, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Float", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(float), "f", new global::TUnit.Core.ConcreteType(typeof(float)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1.1f), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Long__long(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.NumberArgumentTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Long", "Long", 29, - __InvokeTest_Long__long, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Long", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(long), "l", new global::TUnit.Core.ConcreteType(typeof(long)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1L), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_ULong__ulong(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.NumberArgumentTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "ULong", "ULong", 36, - __InvokeTest_ULong__ulong, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ULong", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(ulong), "l", new global::TUnit.Core.ConcreteType(typeof(ulong)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1UL), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_UInt__uint(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.NumberArgumentTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "UInt", "UInt", 43, - __InvokeTest_UInt__uint, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("UInt", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(uint), "i", new global::TUnit.Core.ConcreteType(typeof(uint)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1U), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.NumberArgumentTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.NumberArgumentTests(); - } + MethodMetadata = __mm_5, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 5, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(1U), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_NumberArgumentTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.NumberArgumentTests), TUnit_TestProject_NumberArgumentTests__TestSource.GetTests, TUnit_TestProject_NumberArgumentTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_NumberArgumentTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_NumberArgumentTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.TestDE.verified.txt b/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.TestDE.verified.txt index 724bfb39e3..9e1952e894 100644 --- a/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.TestDE.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.TestDE.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,106 +7,194 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_NumberArgumentTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.NumberArgumentTests); - var metadata_Int__int = global::TUnit.Core.TestMetadataFactory.Create( - "Int", "Int", 8, - __InvokeTest_Int__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Int", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1), - }, - testSessionId: testSessionId - ); - var metadata_Double__double = global::TUnit.Core.TestMetadataFactory.Create( - "Double", "Double", 15, - __InvokeTest_Double__double, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Double", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(double), "d", new global::TUnit.Core.ConcreteType(typeof(double)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1.1), - }, - testSessionId: testSessionId - ); - var metadata_Float__float = global::TUnit.Core.TestMetadataFactory.Create( - "Float", "Float", 22, - __InvokeTest_Float__float, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Float", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(float), "f", new global::TUnit.Core.ConcreteType(typeof(float)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1.1f), - }, - testSessionId: testSessionId - ); - var metadata_Long__long = global::TUnit.Core.TestMetadataFactory.Create( - "Long", "Long", 29, - __InvokeTest_Long__long, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Long", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(long), "l", new global::TUnit.Core.ConcreteType(typeof(long)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1L), - }, - testSessionId: testSessionId - ); - var metadata_ULong__ulong = global::TUnit.Core.TestMetadataFactory.Create( - "ULong", "ULong", 36, - __InvokeTest_ULong__ulong, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ULong", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(ulong), "l", new global::TUnit.Core.ConcreteType(typeof(ulong)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1UL), - }, - testSessionId: testSessionId - ); - var metadata_UInt__uint = global::TUnit.Core.TestMetadataFactory.Create( - "UInt", "UInt", 43, - __InvokeTest_UInt__uint, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("UInt", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.NumberArgumentTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Int", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("Double", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(double), "d", new global::TUnit.Core.ConcreteType(typeof(double)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("Float", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(float), "f", new global::TUnit.Core.ConcreteType(typeof(float)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_3 = global::TUnit.Core.MethodMetadataFactory.Create("Long", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(long), "l", new global::TUnit.Core.ConcreteType(typeof(long)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_4 = global::TUnit.Core.MethodMetadataFactory.Create("ULong", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(ulong), "l", new global::TUnit.Core.ConcreteType(typeof(ulong)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_5 = global::TUnit.Core.MethodMetadataFactory.Create("UInt", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(uint), "i", new global::TUnit.Core.ConcreteType(typeof(uint)), false, reflectionInfoFactory: static () => 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]) +}); + 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 __Invoke(global::TUnit.TestProject.NumberArgumentTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(uint), "i", new global::TUnit.Core.ConcreteType(typeof(uint)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: + { + 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)); + } + } + case 3: + { + 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)); + } + } + case 4: + { + 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)); + } + } + case 5: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - new global::TUnit.Core.ArgumentsAttribute(1U), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_Int__int, metadata_Double__double, metadata_Float__float, metadata_Long__long, metadata_ULong__ulong, metadata_UInt__uint }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.NumberArgumentTests.Int", - ClassName = "NumberArgumentTests", MethodName = "Int", FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.Int", FilePath = @"", @@ -116,12 +204,19 @@ internal static class TUnit_TestProject_NumberArgumentTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Int__int - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(1), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.NumberArgumentTests.Double", - ClassName = "NumberArgumentTests", MethodName = "Double", FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.Double", FilePath = @"", @@ -131,12 +226,19 @@ internal static class TUnit_TestProject_NumberArgumentTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Double__double - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(1.1), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.NumberArgumentTests.Float", - ClassName = "NumberArgumentTests", MethodName = "Float", FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.Float", FilePath = @"", @@ -146,12 +248,19 @@ internal static class TUnit_TestProject_NumberArgumentTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Float__float - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(1.1f), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.NumberArgumentTests.Long", - ClassName = "NumberArgumentTests", MethodName = "Long", FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.Long", FilePath = @"", @@ -161,12 +270,19 @@ internal static class TUnit_TestProject_NumberArgumentTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Long__long - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_3, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 3, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(1L), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.NumberArgumentTests.ULong", - ClassName = "NumberArgumentTests", MethodName = "ULong", FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.ULong", FilePath = @"", @@ -176,12 +292,19 @@ internal static class TUnit_TestProject_NumberArgumentTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_ULong__ulong - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_4, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 4, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(1UL), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.NumberArgumentTests.UInt", - ClassName = "NumberArgumentTests", MethodName = "UInt", FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.UInt", FilePath = @"", @@ -191,317 +314,20 @@ internal static class TUnit_TestProject_NumberArgumentTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_UInt__uint - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Int__int(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Double__double(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Float__float(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Long__long(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_ULong__ulong(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_UInt__uint(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Int__int(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.NumberArgumentTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Int", "Int", 8, - __InvokeTest_Int__int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Int", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "i", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Double__double(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.NumberArgumentTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Double", "Double", 15, - __InvokeTest_Double__double, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Double", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(double), "d", new global::TUnit.Core.ConcreteType(typeof(double)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1.1), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Float__float(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.NumberArgumentTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Float", "Float", 22, - __InvokeTest_Float__float, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Float", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(float), "f", new global::TUnit.Core.ConcreteType(typeof(float)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1.1f), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Long__long(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.NumberArgumentTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Long", "Long", 29, - __InvokeTest_Long__long, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Long", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(long), "l", new global::TUnit.Core.ConcreteType(typeof(long)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1L), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_ULong__ulong(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.NumberArgumentTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "ULong", "ULong", 36, - __InvokeTest_ULong__ulong, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("ULong", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(ulong), "l", new global::TUnit.Core.ConcreteType(typeof(ulong)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1UL), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_UInt__uint(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.NumberArgumentTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "UInt", "UInt", 43, - __InvokeTest_UInt__uint, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("UInt", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(uint), "i", new global::TUnit.Core.ConcreteType(typeof(uint)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1U), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.NumberArgumentTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.NumberArgumentTests(); - } + MethodMetadata = __mm_5, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 5, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(1U), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_NumberArgumentTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.NumberArgumentTests), TUnit_TestProject_NumberArgumentTests__TestSource.GetTests, TUnit_TestProject_NumberArgumentTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_NumberArgumentTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_NumberArgumentTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/PriorityFilteringTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/PriorityFilteringTests.Test.verified.txt index 3aa41ad3f4..6ff9e9d418 100644 --- a/TUnit.Core.SourceGenerator.Tests/PriorityFilteringTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/PriorityFilteringTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,64 +7,138 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_PriorityFilteringTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.PriorityFilteringTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.PriorityFilteringTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("High_1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("High_2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("High_3", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_3 = global::TUnit.Core.MethodMetadataFactory.Create("Medium_1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_4 = global::TUnit.Core.MethodMetadataFactory.Create("Medium_2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_5 = global::TUnit.Core.MethodMetadataFactory.Create("Low_1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static global::TUnit.TestProject.PriorityFilteringTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.PriorityFilteringTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.PriorityFilteringTests); - var metadata_High_1 = global::TUnit.Core.TestMetadataFactory.Create( - "High_1", "High_1", 12, - __InvokeTest_High_1, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("High_1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - var metadata_High_2 = global::TUnit.Core.TestMetadataFactory.Create( - "High_2", "High_2", 18, - __InvokeTest_High_2, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("High_2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - var metadata_High_3 = global::TUnit.Core.TestMetadataFactory.Create( - "High_3", "High_3", 24, - __InvokeTest_High_3, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("High_3", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - var metadata_Medium_1 = global::TUnit.Core.TestMetadataFactory.Create( - "Medium_1", "Medium_1", 30, - __InvokeTest_Medium_1, __CreateAttributes_1, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Medium_1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - var metadata_Medium_2 = global::TUnit.Core.TestMetadataFactory.Create( - "Medium_2", "Medium_2", 36, - __InvokeTest_Medium_2, __CreateAttributes_1, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Medium_2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - var metadata_Low_1 = global::TUnit.Core.TestMetadataFactory.Create( - "Low_1", "Low_1", 42, - __InvokeTest_Low_1, __CreateAttributes_2, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Low_1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_High_1, metadata_High_2, metadata_High_3, metadata_Medium_1, metadata_Medium_2, metadata_Low_1 }; + return new global::TUnit.TestProject.PriorityFilteringTests(); } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Threading.Tasks.ValueTask __Invoke(global::TUnit.TestProject.PriorityFilteringTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) + { + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: + { + 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)); + } + } + case 3: + { + 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)); + } + } + case 4: + { + 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)); + } + } + case 5: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.PriorityAttribute(global::TUnit.TestProject.Enums.PriorityLevel.High) + ]; + } + case 1: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.PriorityAttribute(global::TUnit.TestProject.Enums.PriorityLevel.Medium) + ]; + } + case 2: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.PriorityAttribute(global::TUnit.TestProject.Enums.PriorityLevel.Low) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } + } + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.PriorityFilteringTests.High_1", - ClassName = "PriorityFilteringTests", MethodName = "High_1", FullyQualifiedName = "TUnit.TestProject.PriorityFilteringTests.High_1", FilePath = @"", @@ -74,12 +148,15 @@ internal static class TUnit_TestProject_PriorityFilteringTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_High_1 - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.PriorityFilteringTests.High_2", - ClassName = "PriorityFilteringTests", MethodName = "High_2", FullyQualifiedName = "TUnit.TestProject.PriorityFilteringTests.High_2", FilePath = @"", @@ -89,12 +166,15 @@ internal static class TUnit_TestProject_PriorityFilteringTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_High_2 - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.PriorityFilteringTests.High_3", - ClassName = "PriorityFilteringTests", MethodName = "High_3", FullyQualifiedName = "TUnit.TestProject.PriorityFilteringTests.High_3", FilePath = @"", @@ -104,12 +184,15 @@ internal static class TUnit_TestProject_PriorityFilteringTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_High_3 - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.PriorityFilteringTests.Medium_1", - ClassName = "PriorityFilteringTests", MethodName = "Medium_1", FullyQualifiedName = "TUnit.TestProject.PriorityFilteringTests.Medium_1", FilePath = @"", @@ -119,12 +202,15 @@ internal static class TUnit_TestProject_PriorityFilteringTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Medium_1 - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_3, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 3, + CreateAttributes = __Attributes, + AttributeGroupIndex = 1, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.PriorityFilteringTests.Medium_2", - ClassName = "PriorityFilteringTests", MethodName = "Medium_2", FullyQualifiedName = "TUnit.TestProject.PriorityFilteringTests.Medium_2", FilePath = @"", @@ -134,12 +220,15 @@ internal static class TUnit_TestProject_PriorityFilteringTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Medium_2 - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_4, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 4, + CreateAttributes = __Attributes, + AttributeGroupIndex = 1, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.PriorityFilteringTests.Low_1", - ClassName = "PriorityFilteringTests", MethodName = "Low_1", FullyQualifiedName = "TUnit.TestProject.PriorityFilteringTests.Low_1", FilePath = @"", @@ -149,237 +238,16 @@ internal static class TUnit_TestProject_PriorityFilteringTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Low_1 - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.PriorityAttribute(global::TUnit.TestProject.Enums.PriorityLevel.High) - ]; - } - private static global::System.Attribute[] __CreateAttributes_1() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.PriorityAttribute(global::TUnit.TestProject.Enums.PriorityLevel.Medium) - ]; - } - private static global::System.Attribute[] __CreateAttributes_2() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.PriorityAttribute(global::TUnit.TestProject.Enums.PriorityLevel.Low) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_High_1(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_High_2(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_High_3(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Medium_1(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Medium_2(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Low_1(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_High_1(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.PriorityFilteringTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.PriorityFilteringTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "High_1", "High_1", 12, - __InvokeTest_High_1, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("High_1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_High_2(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.PriorityFilteringTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.PriorityFilteringTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "High_2", "High_2", 18, - __InvokeTest_High_2, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("High_2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_High_3(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.PriorityFilteringTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.PriorityFilteringTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "High_3", "High_3", 24, - __InvokeTest_High_3, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("High_3", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Medium_1(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.PriorityFilteringTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.PriorityFilteringTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Medium_1", "Medium_1", 30, - __InvokeTest_Medium_1, __CreateAttributes_1, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Medium_1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Medium_2(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.PriorityFilteringTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.PriorityFilteringTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Medium_2", "Medium_2", 36, - __InvokeTest_Medium_2, __CreateAttributes_1, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Medium_2", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Low_1(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.PriorityFilteringTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.PriorityFilteringTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Low_1", "Low_1", 42, - __InvokeTest_Low_1, __CreateAttributes_2, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Low_1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.PriorityFilteringTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.PriorityFilteringTests(); - } + MethodMetadata = __mm_5, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 5, + CreateAttributes = __Attributes, + AttributeGroupIndex = 2, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_PriorityFilteringTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.PriorityFilteringTests), TUnit_TestProject_PriorityFilteringTests__TestSource.GetTests, TUnit_TestProject_PriorityFilteringTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_PriorityFilteringTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_PriorityFilteringTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/PropertySetterTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/PropertySetterTests.Test.verified.txt index 4b5c5bb687..b17dab8ac5 100644 --- a/TUnit.Core.SourceGenerator.Tests/PropertySetterTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/PropertySetterTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -21,276 +21,162 @@ internal static class TUnit_TestProject_PropertySetterTests__TestSource [global::System.Runtime.CompilerServices.UnsafeAccessor(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Field, Name = "k__BackingField")] private static extern ref string GetProperty7BackingField(global::TUnit.TestProject.PropertySetterTests instance); #endif - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.PropertySetterTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.PropertySetterTests", 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[] - { - 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! - } + 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[] + { + 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! }, - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.PropertySetterTests); - var metadata_Test = global::TUnit.Core.TestMetadataFactory.Create( - "Test", "Test", 69, - __InvokeTest_Test, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - propertyDataSources: new global::TUnit.Core.PropertyDataSource[] - { - new global::TUnit.Core.PropertyDataSource - { - PropertyName = "Property2", - PropertyType = typeof(string), - DataSource = new global::TUnit.Core.MethodDataSourceAttribute("MethodData") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.PropertySetterTests.MethodData(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, + 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.PropertyDataSource - { - PropertyName = "Property3", - PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - DataSource = new global::TUnit.Core.ClassDataSourceAttribute(), + 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.PropertyDataSource - { - PropertyName = "Property4", - PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - DataSource = new global::TUnit.Core.ClassDataSourceAttribute() - {Shared = global::TUnit.Core.SharedType.PerTestSession,}, + 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.PropertyDataSource - { - PropertyName = "Property5", - PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - DataSource = new global::TUnit.Core.ClassDataSourceAttribute() - {Shared = global::TUnit.Core.SharedType.PerClass,}, + 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.PropertyDataSource - { - PropertyName = "Property6", - PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - DataSource = new global::TUnit.Core.ClassDataSourceAttribute() - {Shared = global::TUnit.Core.SharedType.Keyed,Key = "Key",}, + 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.PropertyDataSource - { - PropertyName = "Property7", - PropertyType = typeof(string), - DataSource = new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), + 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! + } }, - propertyInjections: new global::TUnit.Core.PropertyInjectionData[] + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.PropertySetterTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Test", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static global::TUnit.TestProject.PropertySetterTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.PropertySetterTests() { - new global::TUnit.Core.PropertyInjectionData - { - PropertyName = "Property2", - PropertyType = typeof(string), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetProperty2BackingField((global::TUnit.TestProject.PropertySetterTests)instance) = (string)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => - { - return new global::System.Collections.Generic.Dictionary(); - } - }, - new global::TUnit.Core.PropertyInjectionData - { - PropertyName = "Property3", - PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetProperty3BackingField((global::TUnit.TestProject.PropertySetterTests)instance) = (global::TUnit.TestProject.PropertySetterTests.InnerModel)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => - { - return new global::System.Collections.Generic.Dictionary(); - } - }, - new global::TUnit.Core.PropertyInjectionData - { - PropertyName = "Property4", - PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetProperty4BackingField((global::TUnit.TestProject.PropertySetterTests)instance) = (global::TUnit.TestProject.PropertySetterTests.InnerModel)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => - { - return new global::System.Collections.Generic.Dictionary(); - } - }, - new global::TUnit.Core.PropertyInjectionData + Property1 = default!, + Property2 = default!, + Property3 = default!, + Property4 = default!, + Property5 = default!, + Property6 = default!, + Property7 = default!, + }; + } + private static global::System.Threading.Tasks.ValueTask __Invoke(global::TUnit.TestProject.PropertySetterTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) + { + case 0: { - PropertyName = "Property5", - PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetProperty5BackingField((global::TUnit.TestProject.PropertySetterTests)instance) = (global::TUnit.TestProject.PropertySetterTests.InnerModel)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => + try { - return new global::System.Collections.Generic.Dictionary(); + return new global::System.Threading.Tasks.ValueTask(instance.Test()); } - }, - new global::TUnit.Core.PropertyInjectionData - { - PropertyName = "Property6", - PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetProperty6BackingField((global::TUnit.TestProject.PropertySetterTests)instance) = (global::TUnit.TestProject.PropertySetterTests.InnerModel)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => + catch (global::System.Exception ex) { - return new global::System.Collections.Generic.Dictionary(); + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } - }, - new global::TUnit.Core.PropertyInjectionData + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) + { + case 0: { - PropertyName = "Property7", - PropertyType = typeof(string), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetProperty7BackingField((global::TUnit.TestProject.PropertySetterTests)instance) = (string)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => - { - return new global::System.Collections.Generic.Dictionary(); - } - }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_Test }; + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.NotInParallelAttribute("PropertySetterTests") + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.PropertySetterTests.Test", - ClassName = "PropertySetterTests", MethodName = "Test", FullyQualifiedName = "TUnit.TestProject.PropertySetterTests.Test", FilePath = @"", @@ -300,308 +186,16 @@ internal static class TUnit_TestProject_PropertySetterTests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Test - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - 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::System.Threading.Tasks.ValueTask __InvokeTest_Test(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.PropertySetterTests", 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[] - { - 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! - } - }, - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.PropertySetterTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Test", "Test", 69, - __InvokeTest_Test, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - propertyDataSources: new global::TUnit.Core.PropertyDataSource[] - { - new global::TUnit.Core.PropertyDataSource - { - PropertyName = "Property2", - PropertyType = typeof(string), - DataSource = new global::TUnit.Core.MethodDataSourceAttribute("MethodData") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.PropertySetterTests.MethodData(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, - }, - new global::TUnit.Core.PropertyDataSource - { - PropertyName = "Property3", - PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - DataSource = new global::TUnit.Core.ClassDataSourceAttribute(), - }, - new global::TUnit.Core.PropertyDataSource - { - PropertyName = "Property4", - PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - DataSource = new global::TUnit.Core.ClassDataSourceAttribute() - {Shared = global::TUnit.Core.SharedType.PerTestSession,}, - }, - new global::TUnit.Core.PropertyDataSource - { - PropertyName = "Property5", - PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - DataSource = new global::TUnit.Core.ClassDataSourceAttribute() - {Shared = global::TUnit.Core.SharedType.PerClass,}, - }, - new global::TUnit.Core.PropertyDataSource - { - PropertyName = "Property6", - PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - DataSource = new global::TUnit.Core.ClassDataSourceAttribute() - {Shared = global::TUnit.Core.SharedType.Keyed,Key = "Key",}, - }, - new global::TUnit.Core.PropertyDataSource - { - PropertyName = "Property7", - PropertyType = typeof(string), - DataSource = new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), - }, - }, - propertyInjections: new global::TUnit.Core.PropertyInjectionData[] - { - new global::TUnit.Core.PropertyInjectionData - { - PropertyName = "Property2", - PropertyType = typeof(string), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetProperty2BackingField((global::TUnit.TestProject.PropertySetterTests)instance) = (string)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => - { - return new global::System.Collections.Generic.Dictionary(); - } - }, - new global::TUnit.Core.PropertyInjectionData - { - PropertyName = "Property3", - PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetProperty3BackingField((global::TUnit.TestProject.PropertySetterTests)instance) = (global::TUnit.TestProject.PropertySetterTests.InnerModel)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => - { - return new global::System.Collections.Generic.Dictionary(); - } - }, - new global::TUnit.Core.PropertyInjectionData - { - PropertyName = "Property4", - PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetProperty4BackingField((global::TUnit.TestProject.PropertySetterTests)instance) = (global::TUnit.TestProject.PropertySetterTests.InnerModel)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => - { - return new global::System.Collections.Generic.Dictionary(); - } - }, - new global::TUnit.Core.PropertyInjectionData - { - PropertyName = "Property5", - PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetProperty5BackingField((global::TUnit.TestProject.PropertySetterTests)instance) = (global::TUnit.TestProject.PropertySetterTests.InnerModel)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => - { - return new global::System.Collections.Generic.Dictionary(); - } - }, - new global::TUnit.Core.PropertyInjectionData - { - PropertyName = "Property6", - PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetProperty6BackingField((global::TUnit.TestProject.PropertySetterTests)instance) = (global::TUnit.TestProject.PropertySetterTests.InnerModel)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => - { - return new global::System.Collections.Generic.Dictionary(); - } + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, }, - new global::TUnit.Core.PropertyInjectionData - { - PropertyName = "Property7", - PropertyType = typeof(string), - #if NET8_0_OR_GREATER - Setter = (instance, value) => GetProperty7BackingField((global::TUnit.TestProject.PropertySetterTests)instance) = (string)value, - #else - Setter = (instance, value) => throw new global::System.NotSupportedException("Setting init-only properties requires .NET 8 or later"), - #endif - ValueFactory = () => throw new global::System.InvalidOperationException("ValueFactory should be provided by TestDataCombination"), - NestedPropertyInjections = global::System.Array.Empty(), - NestedPropertyValueFactory = obj => - { - return new global::System.Collections.Generic.Dictionary(); - } - }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal 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!, - }; - } + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_PropertySetterTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.PropertySetterTests), TUnit_TestProject_PropertySetterTests__TestSource.GetTests, TUnit_TestProject_PropertySetterTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_PropertySetterTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_PropertySetterTests__TestSource.Entries); } 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 808e066ba6..6e0cb8ea63 100644 --- a/TUnit.Core.SourceGenerator.Tests/RepeatTests.Assembly_Level_Repeat.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/RepeatTests.Assembly_Level_Repeat.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,42 +7,85 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_AssemblyRepeatTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AssemblyRepeatTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AssemblyRepeatTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.AssemblyRepeatTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("TestWithAssemblyRepeat", __classType, typeof(void), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("TestWithMethodRepeatOverride", __classType, typeof(void), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.AssemblyRepeatTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.AssemblyRepeatTests); - var metadata_TestWithAssemblyRepeat = global::TUnit.Core.TestMetadataFactory.Create( - "TestWithAssemblyRepeat", "TestWithAssemblyRepeat", 9, - __InvokeTest_TestWithAssemblyRepeat, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("TestWithAssemblyRepeat", __classType, typeof(void), __classMetadata), - repeatCount: 3, - testSessionId: testSessionId - ); - var metadata_TestWithMethodRepeatOverride = global::TUnit.Core.TestMetadataFactory.Create( - "TestWithMethodRepeatOverride", "TestWithMethodRepeatOverride", 14, - __InvokeTest_TestWithMethodRepeatOverride, __CreateAttributes_1, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("TestWithMethodRepeatOverride", __classType, typeof(void), __classMetadata), - repeatCount: 1, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_TestWithAssemblyRepeat, metadata_TestWithMethodRepeatOverride }; + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.RepeatAttribute(3) + ]; + } + case 1: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.RepeatAttribute(1), + new global::TUnit.Core.RepeatAttribute(3) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.AssemblyRepeatTests.TestWithAssemblyRepeat", - ClassName = "AssemblyRepeatTests", MethodName = "TestWithAssemblyRepeat", FullyQualifiedName = "TUnit.TestProject.AssemblyRepeatTests.TestWithAssemblyRepeat", FilePath = @"", @@ -52,12 +95,15 @@ internal static class TUnit_TestProject_AssemblyRepeatTests__TestSource HasDataSource = false, RepeatCount = 3, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_TestWithAssemblyRepeat - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.AssemblyRepeatTests.TestWithMethodRepeatOverride", - ClassName = "AssemblyRepeatTests", MethodName = "TestWithMethodRepeatOverride", FullyQualifiedName = "TUnit.TestProject.AssemblyRepeatTests.TestWithMethodRepeatOverride", FilePath = @"", @@ -67,102 +113,16 @@ internal static class TUnit_TestProject_AssemblyRepeatTests__TestSource HasDataSource = false, RepeatCount = 1, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_TestWithMethodRepeatOverride - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.RepeatAttribute(3) - ]; - } - private static global::System.Attribute[] __CreateAttributes_1() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.RepeatAttribute(1), - new global::TUnit.Core.RepeatAttribute(3) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_TestWithAssemblyRepeat(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_TestWithMethodRepeatOverride(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_TestWithAssemblyRepeat(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AssemblyRepeatTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.AssemblyRepeatTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "TestWithAssemblyRepeat", "TestWithAssemblyRepeat", 9, - __InvokeTest_TestWithAssemblyRepeat, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("TestWithAssemblyRepeat", __classType, typeof(void), __classMetadata), - repeatCount: 3, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_TestWithMethodRepeatOverride(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AssemblyRepeatTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.AssemblyRepeatTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "TestWithMethodRepeatOverride", "TestWithMethodRepeatOverride", 14, - __InvokeTest_TestWithMethodRepeatOverride, __CreateAttributes_1, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("TestWithMethodRepeatOverride", __classType, typeof(void), __classMetadata), - repeatCount: 1, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.AssemblyRepeatTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.AssemblyRepeatTests(); - } + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 1, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_AssemblyRepeatTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.AssemblyRepeatTests), TUnit_TestProject_AssemblyRepeatTests__TestSource.GetTests, TUnit_TestProject_AssemblyRepeatTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_AssemblyRepeatTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_AssemblyRepeatTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/RepeatTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/RepeatTests.Test.verified.txt index b29cab31eb..69d524bdff 100644 --- a/TUnit.Core.SourceGenerator.Tests/RepeatTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/RepeatTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,49 +7,110 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_RepeatTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.RepeatTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.RepeatTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.RepeatTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("One", __classType, typeof(void), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("Two", __classType, typeof(void), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("Three", __classType, typeof(void), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.RepeatTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) + { + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.RepeatTests); - var metadata_One = global::TUnit.Core.TestMetadataFactory.Create( - "One", "One", 9, - __InvokeTest_One, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("One", __classType, typeof(void), __classMetadata), - repeatCount: 1, - testSessionId: testSessionId - ); - var metadata_Two = global::TUnit.Core.TestMetadataFactory.Create( - "Two", "Two", 16, - __InvokeTest_Two, __CreateAttributes_1, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Two", __classType, typeof(void), __classMetadata), - repeatCount: 2, - testSessionId: testSessionId - ); - var metadata_Three = global::TUnit.Core.TestMetadataFactory.Create( - "Three", "Three", 23, - __InvokeTest_Three, __CreateAttributes_2, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Three", __classType, typeof(void), __classMetadata), - repeatCount: 3, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_One, metadata_Two, metadata_Three }; + case 0: + { + 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) + ]; + } + case 1: + { + 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) + ]; + } + case 2: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.RepeatAttribute(3) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.RepeatTests.One", - ClassName = "RepeatTests", MethodName = "One", FullyQualifiedName = "TUnit.TestProject.RepeatTests.One", FilePath = @"", @@ -59,12 +120,15 @@ internal static class TUnit_TestProject_RepeatTests__TestSource HasDataSource = false, RepeatCount = 1, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_One - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.RepeatTests.Two", - ClassName = "RepeatTests", MethodName = "Two", FullyQualifiedName = "TUnit.TestProject.RepeatTests.Two", FilePath = @"", @@ -74,12 +138,15 @@ internal static class TUnit_TestProject_RepeatTests__TestSource HasDataSource = false, RepeatCount = 2, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Two - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 1, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.RepeatTests.Three", - ClassName = "RepeatTests", MethodName = "Three", FullyQualifiedName = "TUnit.TestProject.RepeatTests.Three", FilePath = @"", @@ -89,149 +156,16 @@ internal static class TUnit_TestProject_RepeatTests__TestSource HasDataSource = false, RepeatCount = 3, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Three - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - 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::System.Attribute[] __CreateAttributes_1() - { - 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::System.Attribute[] __CreateAttributes_2() - { - 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::System.Threading.Tasks.ValueTask __InvokeTest_One(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Two(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Three(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_One(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.RepeatTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.RepeatTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "One", "One", 9, - __InvokeTest_One, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("One", __classType, typeof(void), __classMetadata), - repeatCount: 1, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Two(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.RepeatTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.RepeatTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Two", "Two", 16, - __InvokeTest_Two, __CreateAttributes_1, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Two", __classType, typeof(void), __classMetadata), - repeatCount: 2, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Three(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.RepeatTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.RepeatTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Three", "Three", 23, - __InvokeTest_Three, __CreateAttributes_2, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Three", __classType, typeof(void), __classMetadata), - repeatCount: 3, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.RepeatTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.RepeatTests(); - } + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 2, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_RepeatTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.RepeatTests), TUnit_TestProject_RepeatTests__TestSource.GetTests, TUnit_TestProject_RepeatTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_RepeatTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_RepeatTests__TestSource.Entries); } 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 416098f41c..2791c93948 100644 --- a/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet10_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet10_0.verified.txt @@ -7,133 +7,245 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_STAThreadTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.STAThreadTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("With_STA", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("Without_STA", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithSimpleAwait", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_3 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskYield", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_4 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithConfigureAwaitTrue", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_5 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithNestedAsyncCalls", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_6 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskFromResult", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_7 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithCompletedTask", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_8 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskRun", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_9 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithMultipleAwaits", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_10 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithAsyncEnumerable", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_11 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskWhenAll", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_12 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithExceptionHandling", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_13 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithThrowsNothingAssertion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_14 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithFuncAssertion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata_With_STA = global::TUnit.Core.TestMetadataFactory.Create( - "With_STA", "With_STA", 14, - __InvokeTest_With_STA, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("With_STA", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_Without_STA = global::TUnit.Core.TestMetadataFactory.Create( - "Without_STA", "Without_STA", 20, - __InvokeTest_Without_STA, __CreateAttributes_1, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Without_STA", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithSimpleAwait = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithSimpleAwait", "STA_WithSimpleAwait", 26, - __InvokeTest_STA_WithSimpleAwait, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithSimpleAwait", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithTaskYield = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithTaskYield", "STA_WithTaskYield", 36, - __InvokeTest_STA_WithTaskYield, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskYield", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithConfigureAwaitTrue = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithConfigureAwaitTrue", "STA_WithConfigureAwaitTrue", 45, - __InvokeTest_STA_WithConfigureAwaitTrue, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithConfigureAwaitTrue", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithNestedAsyncCalls = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithNestedAsyncCalls", "STA_WithNestedAsyncCalls", 54, - __InvokeTest_STA_WithNestedAsyncCalls, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithNestedAsyncCalls", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithTaskFromResult = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithTaskFromResult", "STA_WithTaskFromResult", 64, - __InvokeTest_STA_WithTaskFromResult, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskFromResult", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithCompletedTask = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithCompletedTask", "STA_WithCompletedTask", 74, - __InvokeTest_STA_WithCompletedTask, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithCompletedTask", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithTaskRun = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithTaskRun", "STA_WithTaskRun", 83, - __InvokeTest_STA_WithTaskRun, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskRun", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithMultipleAwaits = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithMultipleAwaits", "STA_WithMultipleAwaits", 98, - __InvokeTest_STA_WithMultipleAwaits, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithMultipleAwaits", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithAsyncEnumerable = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithAsyncEnumerable", "STA_WithAsyncEnumerable", 116, - __InvokeTest_STA_WithAsyncEnumerable, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithAsyncEnumerable", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithTaskWhenAll = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithTaskWhenAll", "STA_WithTaskWhenAll", 130, - __InvokeTest_STA_WithTaskWhenAll, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskWhenAll", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithExceptionHandling = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithExceptionHandling", "STA_WithExceptionHandling", 147, - __InvokeTest_STA_WithExceptionHandling, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithExceptionHandling", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithThrowsNothingAssertion = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithThrowsNothingAssertion", "STA_WithThrowsNothingAssertion", 194, - __InvokeTest_STA_WithThrowsNothingAssertion, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithThrowsNothingAssertion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithFuncAssertion = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithFuncAssertion", "STA_WithFuncAssertion", 211, - __InvokeTest_STA_WithFuncAssertion, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithFuncAssertion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_With_STA, metadata_Without_STA, metadata_STA_WithSimpleAwait, metadata_STA_WithTaskYield, metadata_STA_WithConfigureAwaitTrue, metadata_STA_WithNestedAsyncCalls, metadata_STA_WithTaskFromResult, metadata_STA_WithCompletedTask, metadata_STA_WithTaskRun, metadata_STA_WithMultipleAwaits, metadata_STA_WithAsyncEnumerable, metadata_STA_WithTaskWhenAll, metadata_STA_WithExceptionHandling, metadata_STA_WithThrowsNothingAssertion, metadata_STA_WithFuncAssertion }; + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke(global::TUnit.TestProject.STAThreadTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) + { + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: + { + 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)); + } + } + case 3: + { + 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)); + } + } + case 4: + { + 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)); + } + } + case 5: + { + 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)); + } + } + case 6: + { + 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)); + } + } + case 7: + { + 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)); + } + } + case 8: + { + 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)); + } + } + case 9: + { + 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)); + } + } + case 10: + { + 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)); + } + } + case 11: + { + 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)); + } + } + case 12: + { + 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)); + } + } + case 13: + { + 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)); + } + } + case 14: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) + { + case 0: + { + 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") + ]; + } + case 1: + { + 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") + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.With_STA", - ClassName = "STAThreadTests", MethodName = "With_STA", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.With_STA", FilePath = @"", @@ -143,12 +255,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_With_STA - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.Without_STA", - ClassName = "STAThreadTests", MethodName = "Without_STA", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.Without_STA", FilePath = @"", @@ -158,12 +273,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Without_STA - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 1, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithSimpleAwait", - ClassName = "STAThreadTests", MethodName = "STA_WithSimpleAwait", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithSimpleAwait", FilePath = @"", @@ -173,12 +291,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithSimpleAwait - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithTaskYield", - ClassName = "STAThreadTests", MethodName = "STA_WithTaskYield", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskYield", FilePath = @"", @@ -188,12 +309,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithTaskYield - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_3, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 3, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithConfigureAwaitTrue", - ClassName = "STAThreadTests", MethodName = "STA_WithConfigureAwaitTrue", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithConfigureAwaitTrue", FilePath = @"", @@ -203,12 +327,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithConfigureAwaitTrue - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_4, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 4, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithNestedAsyncCalls", - ClassName = "STAThreadTests", MethodName = "STA_WithNestedAsyncCalls", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithNestedAsyncCalls", FilePath = @"", @@ -218,12 +345,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithNestedAsyncCalls - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_5, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 5, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithTaskFromResult", - ClassName = "STAThreadTests", MethodName = "STA_WithTaskFromResult", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskFromResult", FilePath = @"", @@ -233,12 +363,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithTaskFromResult - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_6, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 6, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithCompletedTask", - ClassName = "STAThreadTests", MethodName = "STA_WithCompletedTask", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithCompletedTask", FilePath = @"", @@ -248,12 +381,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithCompletedTask - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_7, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 7, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithTaskRun", - ClassName = "STAThreadTests", MethodName = "STA_WithTaskRun", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskRun", FilePath = @"", @@ -263,12 +399,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithTaskRun - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_8, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 8, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithMultipleAwaits", - ClassName = "STAThreadTests", MethodName = "STA_WithMultipleAwaits", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithMultipleAwaits", FilePath = @"", @@ -278,12 +417,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithMultipleAwaits - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_9, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 9, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithAsyncEnumerable", - ClassName = "STAThreadTests", MethodName = "STA_WithAsyncEnumerable", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithAsyncEnumerable", FilePath = @"", @@ -293,12 +435,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithAsyncEnumerable - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_10, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 10, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithTaskWhenAll", - ClassName = "STAThreadTests", MethodName = "STA_WithTaskWhenAll", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskWhenAll", FilePath = @"", @@ -308,12 +453,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithTaskWhenAll - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_11, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 11, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithExceptionHandling", - ClassName = "STAThreadTests", MethodName = "STA_WithExceptionHandling", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithExceptionHandling", FilePath = @"", @@ -323,12 +471,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithExceptionHandling - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_12, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 12, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithThrowsNothingAssertion", - ClassName = "STAThreadTests", MethodName = "STA_WithThrowsNothingAssertion", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithThrowsNothingAssertion", FilePath = @"", @@ -338,12 +489,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithThrowsNothingAssertion - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_13, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 13, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithFuncAssertion", - ClassName = "STAThreadTests", MethodName = "STA_WithFuncAssertion", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithFuncAssertion", FilePath = @"", @@ -353,548 +507,16 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithFuncAssertion - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - 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::System.Attribute[] __CreateAttributes_1() - { - 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::System.Threading.Tasks.ValueTask __InvokeTest_With_STA(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Without_STA(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithSimpleAwait(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithTaskYield(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithConfigureAwaitTrue(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithNestedAsyncCalls(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithTaskFromResult(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithCompletedTask(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithTaskRun(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithMultipleAwaits(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithAsyncEnumerable(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithTaskWhenAll(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithExceptionHandling(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithThrowsNothingAssertion(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithFuncAssertion(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_With_STA(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "With_STA", "With_STA", 14, - __InvokeTest_With_STA, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("With_STA", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Without_STA(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Without_STA", "Without_STA", 20, - __InvokeTest_Without_STA, __CreateAttributes_1, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Without_STA", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithSimpleAwait(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithSimpleAwait", "STA_WithSimpleAwait", 26, - __InvokeTest_STA_WithSimpleAwait, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithSimpleAwait", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithTaskYield(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithTaskYield", "STA_WithTaskYield", 36, - __InvokeTest_STA_WithTaskYield, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskYield", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithConfigureAwaitTrue(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithConfigureAwaitTrue", "STA_WithConfigureAwaitTrue", 45, - __InvokeTest_STA_WithConfigureAwaitTrue, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithConfigureAwaitTrue", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithNestedAsyncCalls(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithNestedAsyncCalls", "STA_WithNestedAsyncCalls", 54, - __InvokeTest_STA_WithNestedAsyncCalls, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithNestedAsyncCalls", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithTaskFromResult(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithTaskFromResult", "STA_WithTaskFromResult", 64, - __InvokeTest_STA_WithTaskFromResult, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskFromResult", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithCompletedTask(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithCompletedTask", "STA_WithCompletedTask", 74, - __InvokeTest_STA_WithCompletedTask, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithCompletedTask", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithTaskRun(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithTaskRun", "STA_WithTaskRun", 83, - __InvokeTest_STA_WithTaskRun, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskRun", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithMultipleAwaits(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithMultipleAwaits", "STA_WithMultipleAwaits", 98, - __InvokeTest_STA_WithMultipleAwaits, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithMultipleAwaits", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithAsyncEnumerable(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithAsyncEnumerable", "STA_WithAsyncEnumerable", 116, - __InvokeTest_STA_WithAsyncEnumerable, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithAsyncEnumerable", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithTaskWhenAll(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithTaskWhenAll", "STA_WithTaskWhenAll", 130, - __InvokeTest_STA_WithTaskWhenAll, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskWhenAll", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithExceptionHandling(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithExceptionHandling", "STA_WithExceptionHandling", 147, - __InvokeTest_STA_WithExceptionHandling, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithExceptionHandling", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithThrowsNothingAssertion(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithThrowsNothingAssertion", "STA_WithThrowsNothingAssertion", 194, - __InvokeTest_STA_WithThrowsNothingAssertion, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithThrowsNothingAssertion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithFuncAssertion(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithFuncAssertion", "STA_WithFuncAssertion", 211, - __InvokeTest_STA_WithFuncAssertion, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithFuncAssertion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.STAThreadTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } + MethodMetadata = __mm_14, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 14, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_STAThreadTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.STAThreadTests), TUnit_TestProject_STAThreadTests__TestSource.GetTests, TUnit_TestProject_STAThreadTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_STAThreadTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_STAThreadTests__TestSource.Entries); } 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 416098f41c..2791c93948 100644 --- a/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet8_0.verified.txt @@ -7,133 +7,245 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_STAThreadTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.STAThreadTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("With_STA", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("Without_STA", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithSimpleAwait", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_3 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskYield", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_4 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithConfigureAwaitTrue", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_5 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithNestedAsyncCalls", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_6 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskFromResult", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_7 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithCompletedTask", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_8 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskRun", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_9 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithMultipleAwaits", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_10 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithAsyncEnumerable", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_11 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskWhenAll", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_12 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithExceptionHandling", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_13 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithThrowsNothingAssertion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_14 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithFuncAssertion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata_With_STA = global::TUnit.Core.TestMetadataFactory.Create( - "With_STA", "With_STA", 14, - __InvokeTest_With_STA, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("With_STA", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_Without_STA = global::TUnit.Core.TestMetadataFactory.Create( - "Without_STA", "Without_STA", 20, - __InvokeTest_Without_STA, __CreateAttributes_1, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Without_STA", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithSimpleAwait = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithSimpleAwait", "STA_WithSimpleAwait", 26, - __InvokeTest_STA_WithSimpleAwait, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithSimpleAwait", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithTaskYield = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithTaskYield", "STA_WithTaskYield", 36, - __InvokeTest_STA_WithTaskYield, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskYield", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithConfigureAwaitTrue = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithConfigureAwaitTrue", "STA_WithConfigureAwaitTrue", 45, - __InvokeTest_STA_WithConfigureAwaitTrue, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithConfigureAwaitTrue", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithNestedAsyncCalls = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithNestedAsyncCalls", "STA_WithNestedAsyncCalls", 54, - __InvokeTest_STA_WithNestedAsyncCalls, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithNestedAsyncCalls", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithTaskFromResult = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithTaskFromResult", "STA_WithTaskFromResult", 64, - __InvokeTest_STA_WithTaskFromResult, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskFromResult", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithCompletedTask = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithCompletedTask", "STA_WithCompletedTask", 74, - __InvokeTest_STA_WithCompletedTask, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithCompletedTask", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithTaskRun = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithTaskRun", "STA_WithTaskRun", 83, - __InvokeTest_STA_WithTaskRun, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskRun", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithMultipleAwaits = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithMultipleAwaits", "STA_WithMultipleAwaits", 98, - __InvokeTest_STA_WithMultipleAwaits, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithMultipleAwaits", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithAsyncEnumerable = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithAsyncEnumerable", "STA_WithAsyncEnumerable", 116, - __InvokeTest_STA_WithAsyncEnumerable, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithAsyncEnumerable", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithTaskWhenAll = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithTaskWhenAll", "STA_WithTaskWhenAll", 130, - __InvokeTest_STA_WithTaskWhenAll, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskWhenAll", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithExceptionHandling = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithExceptionHandling", "STA_WithExceptionHandling", 147, - __InvokeTest_STA_WithExceptionHandling, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithExceptionHandling", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithThrowsNothingAssertion = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithThrowsNothingAssertion", "STA_WithThrowsNothingAssertion", 194, - __InvokeTest_STA_WithThrowsNothingAssertion, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithThrowsNothingAssertion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithFuncAssertion = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithFuncAssertion", "STA_WithFuncAssertion", 211, - __InvokeTest_STA_WithFuncAssertion, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithFuncAssertion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_With_STA, metadata_Without_STA, metadata_STA_WithSimpleAwait, metadata_STA_WithTaskYield, metadata_STA_WithConfigureAwaitTrue, metadata_STA_WithNestedAsyncCalls, metadata_STA_WithTaskFromResult, metadata_STA_WithCompletedTask, metadata_STA_WithTaskRun, metadata_STA_WithMultipleAwaits, metadata_STA_WithAsyncEnumerable, metadata_STA_WithTaskWhenAll, metadata_STA_WithExceptionHandling, metadata_STA_WithThrowsNothingAssertion, metadata_STA_WithFuncAssertion }; + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke(global::TUnit.TestProject.STAThreadTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) + { + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: + { + 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)); + } + } + case 3: + { + 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)); + } + } + case 4: + { + 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)); + } + } + case 5: + { + 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)); + } + } + case 6: + { + 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)); + } + } + case 7: + { + 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)); + } + } + case 8: + { + 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)); + } + } + case 9: + { + 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)); + } + } + case 10: + { + 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)); + } + } + case 11: + { + 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)); + } + } + case 12: + { + 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)); + } + } + case 13: + { + 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)); + } + } + case 14: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) + { + case 0: + { + 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") + ]; + } + case 1: + { + 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") + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.With_STA", - ClassName = "STAThreadTests", MethodName = "With_STA", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.With_STA", FilePath = @"", @@ -143,12 +255,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_With_STA - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.Without_STA", - ClassName = "STAThreadTests", MethodName = "Without_STA", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.Without_STA", FilePath = @"", @@ -158,12 +273,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Without_STA - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 1, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithSimpleAwait", - ClassName = "STAThreadTests", MethodName = "STA_WithSimpleAwait", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithSimpleAwait", FilePath = @"", @@ -173,12 +291,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithSimpleAwait - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithTaskYield", - ClassName = "STAThreadTests", MethodName = "STA_WithTaskYield", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskYield", FilePath = @"", @@ -188,12 +309,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithTaskYield - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_3, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 3, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithConfigureAwaitTrue", - ClassName = "STAThreadTests", MethodName = "STA_WithConfigureAwaitTrue", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithConfigureAwaitTrue", FilePath = @"", @@ -203,12 +327,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithConfigureAwaitTrue - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_4, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 4, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithNestedAsyncCalls", - ClassName = "STAThreadTests", MethodName = "STA_WithNestedAsyncCalls", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithNestedAsyncCalls", FilePath = @"", @@ -218,12 +345,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithNestedAsyncCalls - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_5, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 5, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithTaskFromResult", - ClassName = "STAThreadTests", MethodName = "STA_WithTaskFromResult", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskFromResult", FilePath = @"", @@ -233,12 +363,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithTaskFromResult - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_6, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 6, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithCompletedTask", - ClassName = "STAThreadTests", MethodName = "STA_WithCompletedTask", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithCompletedTask", FilePath = @"", @@ -248,12 +381,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithCompletedTask - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_7, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 7, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithTaskRun", - ClassName = "STAThreadTests", MethodName = "STA_WithTaskRun", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskRun", FilePath = @"", @@ -263,12 +399,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithTaskRun - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_8, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 8, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithMultipleAwaits", - ClassName = "STAThreadTests", MethodName = "STA_WithMultipleAwaits", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithMultipleAwaits", FilePath = @"", @@ -278,12 +417,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithMultipleAwaits - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_9, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 9, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithAsyncEnumerable", - ClassName = "STAThreadTests", MethodName = "STA_WithAsyncEnumerable", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithAsyncEnumerable", FilePath = @"", @@ -293,12 +435,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithAsyncEnumerable - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_10, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 10, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithTaskWhenAll", - ClassName = "STAThreadTests", MethodName = "STA_WithTaskWhenAll", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskWhenAll", FilePath = @"", @@ -308,12 +453,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithTaskWhenAll - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_11, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 11, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithExceptionHandling", - ClassName = "STAThreadTests", MethodName = "STA_WithExceptionHandling", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithExceptionHandling", FilePath = @"", @@ -323,12 +471,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithExceptionHandling - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_12, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 12, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithThrowsNothingAssertion", - ClassName = "STAThreadTests", MethodName = "STA_WithThrowsNothingAssertion", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithThrowsNothingAssertion", FilePath = @"", @@ -338,12 +489,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithThrowsNothingAssertion - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_13, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 13, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithFuncAssertion", - ClassName = "STAThreadTests", MethodName = "STA_WithFuncAssertion", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithFuncAssertion", FilePath = @"", @@ -353,548 +507,16 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithFuncAssertion - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - 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::System.Attribute[] __CreateAttributes_1() - { - 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::System.Threading.Tasks.ValueTask __InvokeTest_With_STA(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Without_STA(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithSimpleAwait(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithTaskYield(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithConfigureAwaitTrue(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithNestedAsyncCalls(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithTaskFromResult(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithCompletedTask(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithTaskRun(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithMultipleAwaits(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithAsyncEnumerable(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithTaskWhenAll(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithExceptionHandling(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithThrowsNothingAssertion(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithFuncAssertion(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_With_STA(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "With_STA", "With_STA", 14, - __InvokeTest_With_STA, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("With_STA", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Without_STA(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Without_STA", "Without_STA", 20, - __InvokeTest_Without_STA, __CreateAttributes_1, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Without_STA", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithSimpleAwait(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithSimpleAwait", "STA_WithSimpleAwait", 26, - __InvokeTest_STA_WithSimpleAwait, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithSimpleAwait", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithTaskYield(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithTaskYield", "STA_WithTaskYield", 36, - __InvokeTest_STA_WithTaskYield, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskYield", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithConfigureAwaitTrue(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithConfigureAwaitTrue", "STA_WithConfigureAwaitTrue", 45, - __InvokeTest_STA_WithConfigureAwaitTrue, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithConfigureAwaitTrue", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithNestedAsyncCalls(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithNestedAsyncCalls", "STA_WithNestedAsyncCalls", 54, - __InvokeTest_STA_WithNestedAsyncCalls, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithNestedAsyncCalls", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithTaskFromResult(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithTaskFromResult", "STA_WithTaskFromResult", 64, - __InvokeTest_STA_WithTaskFromResult, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskFromResult", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithCompletedTask(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithCompletedTask", "STA_WithCompletedTask", 74, - __InvokeTest_STA_WithCompletedTask, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithCompletedTask", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithTaskRun(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithTaskRun", "STA_WithTaskRun", 83, - __InvokeTest_STA_WithTaskRun, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskRun", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithMultipleAwaits(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithMultipleAwaits", "STA_WithMultipleAwaits", 98, - __InvokeTest_STA_WithMultipleAwaits, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithMultipleAwaits", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithAsyncEnumerable(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithAsyncEnumerable", "STA_WithAsyncEnumerable", 116, - __InvokeTest_STA_WithAsyncEnumerable, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithAsyncEnumerable", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithTaskWhenAll(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithTaskWhenAll", "STA_WithTaskWhenAll", 130, - __InvokeTest_STA_WithTaskWhenAll, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskWhenAll", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithExceptionHandling(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithExceptionHandling", "STA_WithExceptionHandling", 147, - __InvokeTest_STA_WithExceptionHandling, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithExceptionHandling", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithThrowsNothingAssertion(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithThrowsNothingAssertion", "STA_WithThrowsNothingAssertion", 194, - __InvokeTest_STA_WithThrowsNothingAssertion, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithThrowsNothingAssertion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithFuncAssertion(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithFuncAssertion", "STA_WithFuncAssertion", 211, - __InvokeTest_STA_WithFuncAssertion, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithFuncAssertion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.STAThreadTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } + MethodMetadata = __mm_14, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 14, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_STAThreadTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.STAThreadTests), TUnit_TestProject_STAThreadTests__TestSource.GetTests, TUnit_TestProject_STAThreadTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_STAThreadTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_STAThreadTests__TestSource.Entries); } 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 416098f41c..2791c93948 100644 --- a/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet9_0.verified.txt @@ -7,133 +7,245 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_STAThreadTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.STAThreadTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("With_STA", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("Without_STA", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithSimpleAwait", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_3 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskYield", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_4 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithConfigureAwaitTrue", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_5 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithNestedAsyncCalls", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_6 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskFromResult", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_7 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithCompletedTask", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_8 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskRun", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_9 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithMultipleAwaits", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_10 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithAsyncEnumerable", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_11 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskWhenAll", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_12 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithExceptionHandling", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_13 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithThrowsNothingAssertion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_14 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithFuncAssertion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata_With_STA = global::TUnit.Core.TestMetadataFactory.Create( - "With_STA", "With_STA", 14, - __InvokeTest_With_STA, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("With_STA", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_Without_STA = global::TUnit.Core.TestMetadataFactory.Create( - "Without_STA", "Without_STA", 20, - __InvokeTest_Without_STA, __CreateAttributes_1, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Without_STA", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithSimpleAwait = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithSimpleAwait", "STA_WithSimpleAwait", 26, - __InvokeTest_STA_WithSimpleAwait, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithSimpleAwait", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithTaskYield = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithTaskYield", "STA_WithTaskYield", 36, - __InvokeTest_STA_WithTaskYield, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskYield", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithConfigureAwaitTrue = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithConfigureAwaitTrue", "STA_WithConfigureAwaitTrue", 45, - __InvokeTest_STA_WithConfigureAwaitTrue, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithConfigureAwaitTrue", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithNestedAsyncCalls = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithNestedAsyncCalls", "STA_WithNestedAsyncCalls", 54, - __InvokeTest_STA_WithNestedAsyncCalls, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithNestedAsyncCalls", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithTaskFromResult = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithTaskFromResult", "STA_WithTaskFromResult", 64, - __InvokeTest_STA_WithTaskFromResult, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskFromResult", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithCompletedTask = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithCompletedTask", "STA_WithCompletedTask", 74, - __InvokeTest_STA_WithCompletedTask, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithCompletedTask", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithTaskRun = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithTaskRun", "STA_WithTaskRun", 83, - __InvokeTest_STA_WithTaskRun, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskRun", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithMultipleAwaits = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithMultipleAwaits", "STA_WithMultipleAwaits", 98, - __InvokeTest_STA_WithMultipleAwaits, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithMultipleAwaits", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithAsyncEnumerable = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithAsyncEnumerable", "STA_WithAsyncEnumerable", 116, - __InvokeTest_STA_WithAsyncEnumerable, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithAsyncEnumerable", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithTaskWhenAll = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithTaskWhenAll", "STA_WithTaskWhenAll", 130, - __InvokeTest_STA_WithTaskWhenAll, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskWhenAll", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithExceptionHandling = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithExceptionHandling", "STA_WithExceptionHandling", 147, - __InvokeTest_STA_WithExceptionHandling, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithExceptionHandling", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithThrowsNothingAssertion = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithThrowsNothingAssertion", "STA_WithThrowsNothingAssertion", 194, - __InvokeTest_STA_WithThrowsNothingAssertion, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithThrowsNothingAssertion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithFuncAssertion = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithFuncAssertion", "STA_WithFuncAssertion", 211, - __InvokeTest_STA_WithFuncAssertion, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithFuncAssertion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_With_STA, metadata_Without_STA, metadata_STA_WithSimpleAwait, metadata_STA_WithTaskYield, metadata_STA_WithConfigureAwaitTrue, metadata_STA_WithNestedAsyncCalls, metadata_STA_WithTaskFromResult, metadata_STA_WithCompletedTask, metadata_STA_WithTaskRun, metadata_STA_WithMultipleAwaits, metadata_STA_WithAsyncEnumerable, metadata_STA_WithTaskWhenAll, metadata_STA_WithExceptionHandling, metadata_STA_WithThrowsNothingAssertion, metadata_STA_WithFuncAssertion }; + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke(global::TUnit.TestProject.STAThreadTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) + { + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: + { + 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)); + } + } + case 3: + { + 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)); + } + } + case 4: + { + 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)); + } + } + case 5: + { + 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)); + } + } + case 6: + { + 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)); + } + } + case 7: + { + 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)); + } + } + case 8: + { + 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)); + } + } + case 9: + { + 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)); + } + } + case 10: + { + 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)); + } + } + case 11: + { + 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)); + } + } + case 12: + { + 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)); + } + } + case 13: + { + 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)); + } + } + case 14: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) + { + case 0: + { + 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") + ]; + } + case 1: + { + 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") + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.With_STA", - ClassName = "STAThreadTests", MethodName = "With_STA", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.With_STA", FilePath = @"", @@ -143,12 +255,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_With_STA - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.Without_STA", - ClassName = "STAThreadTests", MethodName = "Without_STA", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.Without_STA", FilePath = @"", @@ -158,12 +273,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Without_STA - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 1, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithSimpleAwait", - ClassName = "STAThreadTests", MethodName = "STA_WithSimpleAwait", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithSimpleAwait", FilePath = @"", @@ -173,12 +291,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithSimpleAwait - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithTaskYield", - ClassName = "STAThreadTests", MethodName = "STA_WithTaskYield", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskYield", FilePath = @"", @@ -188,12 +309,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithTaskYield - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_3, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 3, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithConfigureAwaitTrue", - ClassName = "STAThreadTests", MethodName = "STA_WithConfigureAwaitTrue", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithConfigureAwaitTrue", FilePath = @"", @@ -203,12 +327,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithConfigureAwaitTrue - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_4, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 4, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithNestedAsyncCalls", - ClassName = "STAThreadTests", MethodName = "STA_WithNestedAsyncCalls", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithNestedAsyncCalls", FilePath = @"", @@ -218,12 +345,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithNestedAsyncCalls - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_5, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 5, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithTaskFromResult", - ClassName = "STAThreadTests", MethodName = "STA_WithTaskFromResult", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskFromResult", FilePath = @"", @@ -233,12 +363,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithTaskFromResult - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_6, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 6, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithCompletedTask", - ClassName = "STAThreadTests", MethodName = "STA_WithCompletedTask", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithCompletedTask", FilePath = @"", @@ -248,12 +381,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithCompletedTask - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_7, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 7, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithTaskRun", - ClassName = "STAThreadTests", MethodName = "STA_WithTaskRun", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskRun", FilePath = @"", @@ -263,12 +399,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithTaskRun - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_8, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 8, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithMultipleAwaits", - ClassName = "STAThreadTests", MethodName = "STA_WithMultipleAwaits", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithMultipleAwaits", FilePath = @"", @@ -278,12 +417,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithMultipleAwaits - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_9, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 9, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithAsyncEnumerable", - ClassName = "STAThreadTests", MethodName = "STA_WithAsyncEnumerable", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithAsyncEnumerable", FilePath = @"", @@ -293,12 +435,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithAsyncEnumerable - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_10, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 10, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithTaskWhenAll", - ClassName = "STAThreadTests", MethodName = "STA_WithTaskWhenAll", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskWhenAll", FilePath = @"", @@ -308,12 +453,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithTaskWhenAll - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_11, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 11, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithExceptionHandling", - ClassName = "STAThreadTests", MethodName = "STA_WithExceptionHandling", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithExceptionHandling", FilePath = @"", @@ -323,12 +471,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithExceptionHandling - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_12, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 12, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithThrowsNothingAssertion", - ClassName = "STAThreadTests", MethodName = "STA_WithThrowsNothingAssertion", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithThrowsNothingAssertion", FilePath = @"", @@ -338,12 +489,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithThrowsNothingAssertion - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_13, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 13, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithFuncAssertion", - ClassName = "STAThreadTests", MethodName = "STA_WithFuncAssertion", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithFuncAssertion", FilePath = @"", @@ -353,548 +507,16 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithFuncAssertion - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - 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::System.Attribute[] __CreateAttributes_1() - { - 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::System.Threading.Tasks.ValueTask __InvokeTest_With_STA(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Without_STA(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithSimpleAwait(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithTaskYield(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithConfigureAwaitTrue(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithNestedAsyncCalls(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithTaskFromResult(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithCompletedTask(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithTaskRun(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithMultipleAwaits(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithAsyncEnumerable(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithTaskWhenAll(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithExceptionHandling(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithThrowsNothingAssertion(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithFuncAssertion(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_With_STA(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "With_STA", "With_STA", 14, - __InvokeTest_With_STA, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("With_STA", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Without_STA(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Without_STA", "Without_STA", 20, - __InvokeTest_Without_STA, __CreateAttributes_1, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Without_STA", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithSimpleAwait(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithSimpleAwait", "STA_WithSimpleAwait", 26, - __InvokeTest_STA_WithSimpleAwait, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithSimpleAwait", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithTaskYield(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithTaskYield", "STA_WithTaskYield", 36, - __InvokeTest_STA_WithTaskYield, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskYield", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithConfigureAwaitTrue(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithConfigureAwaitTrue", "STA_WithConfigureAwaitTrue", 45, - __InvokeTest_STA_WithConfigureAwaitTrue, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithConfigureAwaitTrue", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithNestedAsyncCalls(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithNestedAsyncCalls", "STA_WithNestedAsyncCalls", 54, - __InvokeTest_STA_WithNestedAsyncCalls, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithNestedAsyncCalls", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithTaskFromResult(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithTaskFromResult", "STA_WithTaskFromResult", 64, - __InvokeTest_STA_WithTaskFromResult, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskFromResult", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithCompletedTask(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithCompletedTask", "STA_WithCompletedTask", 74, - __InvokeTest_STA_WithCompletedTask, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithCompletedTask", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithTaskRun(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithTaskRun", "STA_WithTaskRun", 83, - __InvokeTest_STA_WithTaskRun, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskRun", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithMultipleAwaits(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithMultipleAwaits", "STA_WithMultipleAwaits", 98, - __InvokeTest_STA_WithMultipleAwaits, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithMultipleAwaits", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithAsyncEnumerable(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithAsyncEnumerable", "STA_WithAsyncEnumerable", 116, - __InvokeTest_STA_WithAsyncEnumerable, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithAsyncEnumerable", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithTaskWhenAll(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithTaskWhenAll", "STA_WithTaskWhenAll", 130, - __InvokeTest_STA_WithTaskWhenAll, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskWhenAll", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithExceptionHandling(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithExceptionHandling", "STA_WithExceptionHandling", 147, - __InvokeTest_STA_WithExceptionHandling, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithExceptionHandling", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithThrowsNothingAssertion(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithThrowsNothingAssertion", "STA_WithThrowsNothingAssertion", 194, - __InvokeTest_STA_WithThrowsNothingAssertion, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithThrowsNothingAssertion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithFuncAssertion(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithFuncAssertion", "STA_WithFuncAssertion", 211, - __InvokeTest_STA_WithFuncAssertion, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithFuncAssertion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.STAThreadTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } + MethodMetadata = __mm_14, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 14, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_STAThreadTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.STAThreadTests), TUnit_TestProject_STAThreadTests__TestSource.GetTests, TUnit_TestProject_STAThreadTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_STAThreadTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_STAThreadTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.Net4_7.verified.txt b/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.Net4_7.verified.txt index caf281e26d..111908d30d 100644 --- a/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.Net4_7.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.Net4_7.verified.txt @@ -7,133 +7,245 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_STAThreadTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.STAThreadTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("With_STA", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("Without_STA", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithSimpleAwait", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_3 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskYield", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_4 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithConfigureAwaitTrue", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_5 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithNestedAsyncCalls", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_6 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskFromResult", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_7 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithCompletedTask", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_8 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskRun", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_9 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithMultipleAwaits", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_10 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithAsyncEnumerable", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_11 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskWhenAll", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_12 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithExceptionHandling", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_13 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithThrowsNothingAssertion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static readonly global::TUnit.Core.MethodMetadata __mm_14 = global::TUnit.Core.MethodMetadataFactory.Create("STA_WithFuncAssertion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + private static global::TUnit.TestProject.STAThreadTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata_With_STA = global::TUnit.Core.TestMetadataFactory.Create( - "With_STA", "With_STA", 14, - __InvokeTest_With_STA, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("With_STA", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_Without_STA = global::TUnit.Core.TestMetadataFactory.Create( - "Without_STA", "Without_STA", 20, - __InvokeTest_Without_STA, __CreateAttributes_1, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Without_STA", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithSimpleAwait = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithSimpleAwait", "STA_WithSimpleAwait", 26, - __InvokeTest_STA_WithSimpleAwait, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithSimpleAwait", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithTaskYield = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithTaskYield", "STA_WithTaskYield", 36, - __InvokeTest_STA_WithTaskYield, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskYield", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithConfigureAwaitTrue = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithConfigureAwaitTrue", "STA_WithConfigureAwaitTrue", 45, - __InvokeTest_STA_WithConfigureAwaitTrue, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithConfigureAwaitTrue", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithNestedAsyncCalls = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithNestedAsyncCalls", "STA_WithNestedAsyncCalls", 54, - __InvokeTest_STA_WithNestedAsyncCalls, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithNestedAsyncCalls", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithTaskFromResult = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithTaskFromResult", "STA_WithTaskFromResult", 64, - __InvokeTest_STA_WithTaskFromResult, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskFromResult", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithCompletedTask = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithCompletedTask", "STA_WithCompletedTask", 74, - __InvokeTest_STA_WithCompletedTask, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithCompletedTask", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithTaskRun = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithTaskRun", "STA_WithTaskRun", 83, - __InvokeTest_STA_WithTaskRun, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskRun", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithMultipleAwaits = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithMultipleAwaits", "STA_WithMultipleAwaits", 98, - __InvokeTest_STA_WithMultipleAwaits, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithMultipleAwaits", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithAsyncEnumerable = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithAsyncEnumerable", "STA_WithAsyncEnumerable", 116, - __InvokeTest_STA_WithAsyncEnumerable, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithAsyncEnumerable", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithTaskWhenAll = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithTaskWhenAll", "STA_WithTaskWhenAll", 130, - __InvokeTest_STA_WithTaskWhenAll, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskWhenAll", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithExceptionHandling = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithExceptionHandling", "STA_WithExceptionHandling", 147, - __InvokeTest_STA_WithExceptionHandling, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithExceptionHandling", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithThrowsNothingAssertion = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithThrowsNothingAssertion", "STA_WithThrowsNothingAssertion", 194, - __InvokeTest_STA_WithThrowsNothingAssertion, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithThrowsNothingAssertion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - var metadata_STA_WithFuncAssertion = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithFuncAssertion", "STA_WithFuncAssertion", 211, - __InvokeTest_STA_WithFuncAssertion, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithFuncAssertion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_With_STA, metadata_Without_STA, metadata_STA_WithSimpleAwait, metadata_STA_WithTaskYield, metadata_STA_WithConfigureAwaitTrue, metadata_STA_WithNestedAsyncCalls, metadata_STA_WithTaskFromResult, metadata_STA_WithCompletedTask, metadata_STA_WithTaskRun, metadata_STA_WithMultipleAwaits, metadata_STA_WithAsyncEnumerable, metadata_STA_WithTaskWhenAll, metadata_STA_WithExceptionHandling, metadata_STA_WithThrowsNothingAssertion, metadata_STA_WithFuncAssertion }; + return new global::TUnit.TestProject.STAThreadTests(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke(global::TUnit.TestProject.STAThreadTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) + { + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: + { + 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)); + } + } + case 3: + { + 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)); + } + } + case 4: + { + 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)); + } + } + case 5: + { + 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)); + } + } + case 6: + { + 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)); + } + } + case 7: + { + 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)); + } + } + case 8: + { + 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)); + } + } + case 9: + { + 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)); + } + } + case 10: + { + 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)); + } + } + case 11: + { + 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)); + } + } + case 12: + { + 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)); + } + } + case 13: + { + 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)); + } + } + case 14: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) + { + case 0: + { + 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") + ]; + } + case 1: + { + 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") + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.With_STA", - ClassName = "STAThreadTests", MethodName = "With_STA", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.With_STA", FilePath = @"", @@ -143,12 +255,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_With_STA - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.Without_STA", - ClassName = "STAThreadTests", MethodName = "Without_STA", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.Without_STA", FilePath = @"", @@ -158,12 +273,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Without_STA - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 1, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithSimpleAwait", - ClassName = "STAThreadTests", MethodName = "STA_WithSimpleAwait", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithSimpleAwait", FilePath = @"", @@ -173,12 +291,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithSimpleAwait - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithTaskYield", - ClassName = "STAThreadTests", MethodName = "STA_WithTaskYield", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskYield", FilePath = @"", @@ -188,12 +309,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithTaskYield - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_3, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 3, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithConfigureAwaitTrue", - ClassName = "STAThreadTests", MethodName = "STA_WithConfigureAwaitTrue", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithConfigureAwaitTrue", FilePath = @"", @@ -203,12 +327,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithConfigureAwaitTrue - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_4, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 4, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithNestedAsyncCalls", - ClassName = "STAThreadTests", MethodName = "STA_WithNestedAsyncCalls", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithNestedAsyncCalls", FilePath = @"", @@ -218,12 +345,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithNestedAsyncCalls - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_5, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 5, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithTaskFromResult", - ClassName = "STAThreadTests", MethodName = "STA_WithTaskFromResult", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskFromResult", FilePath = @"", @@ -233,12 +363,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithTaskFromResult - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_6, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 6, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithCompletedTask", - ClassName = "STAThreadTests", MethodName = "STA_WithCompletedTask", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithCompletedTask", FilePath = @"", @@ -248,12 +381,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithCompletedTask - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_7, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 7, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithTaskRun", - ClassName = "STAThreadTests", MethodName = "STA_WithTaskRun", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskRun", FilePath = @"", @@ -263,12 +399,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithTaskRun - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_8, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 8, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithMultipleAwaits", - ClassName = "STAThreadTests", MethodName = "STA_WithMultipleAwaits", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithMultipleAwaits", FilePath = @"", @@ -278,12 +417,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithMultipleAwaits - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_9, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 9, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithAsyncEnumerable", - ClassName = "STAThreadTests", MethodName = "STA_WithAsyncEnumerable", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithAsyncEnumerable", FilePath = @"", @@ -293,12 +435,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithAsyncEnumerable - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_10, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 10, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithTaskWhenAll", - ClassName = "STAThreadTests", MethodName = "STA_WithTaskWhenAll", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskWhenAll", FilePath = @"", @@ -308,12 +453,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithTaskWhenAll - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_11, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 11, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithExceptionHandling", - ClassName = "STAThreadTests", MethodName = "STA_WithExceptionHandling", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithExceptionHandling", FilePath = @"", @@ -323,12 +471,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithExceptionHandling - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_12, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 12, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithThrowsNothingAssertion", - ClassName = "STAThreadTests", MethodName = "STA_WithThrowsNothingAssertion", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithThrowsNothingAssertion", FilePath = @"", @@ -338,12 +489,15 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithThrowsNothingAssertion - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_13, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 13, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithFuncAssertion", - ClassName = "STAThreadTests", MethodName = "STA_WithFuncAssertion", FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithFuncAssertion", FilePath = @"", @@ -353,548 +507,16 @@ internal static class TUnit_TestProject_STAThreadTests__TestSource HasDataSource = false, RepeatCount = 100, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_STA_WithFuncAssertion - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - 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::System.Attribute[] __CreateAttributes_1() - { - 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::System.Threading.Tasks.ValueTask __InvokeTest_With_STA(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Without_STA(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithSimpleAwait(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithTaskYield(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithConfigureAwaitTrue(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithNestedAsyncCalls(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithTaskFromResult(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithCompletedTask(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithTaskRun(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithMultipleAwaits(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithAsyncEnumerable(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithTaskWhenAll(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithExceptionHandling(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithThrowsNothingAssertion(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_STA_WithFuncAssertion(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_With_STA(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "With_STA", "With_STA", 14, - __InvokeTest_With_STA, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("With_STA", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Without_STA(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Without_STA", "Without_STA", 20, - __InvokeTest_Without_STA, __CreateAttributes_1, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Without_STA", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithSimpleAwait(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithSimpleAwait", "STA_WithSimpleAwait", 26, - __InvokeTest_STA_WithSimpleAwait, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithSimpleAwait", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithTaskYield(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithTaskYield", "STA_WithTaskYield", 36, - __InvokeTest_STA_WithTaskYield, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskYield", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithConfigureAwaitTrue(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithConfigureAwaitTrue", "STA_WithConfigureAwaitTrue", 45, - __InvokeTest_STA_WithConfigureAwaitTrue, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithConfigureAwaitTrue", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithNestedAsyncCalls(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithNestedAsyncCalls", "STA_WithNestedAsyncCalls", 54, - __InvokeTest_STA_WithNestedAsyncCalls, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithNestedAsyncCalls", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithTaskFromResult(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithTaskFromResult", "STA_WithTaskFromResult", 64, - __InvokeTest_STA_WithTaskFromResult, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskFromResult", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithCompletedTask(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithCompletedTask", "STA_WithCompletedTask", 74, - __InvokeTest_STA_WithCompletedTask, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithCompletedTask", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithTaskRun(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithTaskRun", "STA_WithTaskRun", 83, - __InvokeTest_STA_WithTaskRun, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskRun", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithMultipleAwaits(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithMultipleAwaits", "STA_WithMultipleAwaits", 98, - __InvokeTest_STA_WithMultipleAwaits, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithMultipleAwaits", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithAsyncEnumerable(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithAsyncEnumerable", "STA_WithAsyncEnumerable", 116, - __InvokeTest_STA_WithAsyncEnumerable, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithAsyncEnumerable", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithTaskWhenAll(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithTaskWhenAll", "STA_WithTaskWhenAll", 130, - __InvokeTest_STA_WithTaskWhenAll, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithTaskWhenAll", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithExceptionHandling(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithExceptionHandling", "STA_WithExceptionHandling", 147, - __InvokeTest_STA_WithExceptionHandling, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithExceptionHandling", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithThrowsNothingAssertion(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithThrowsNothingAssertion", "STA_WithThrowsNothingAssertion", 194, - __InvokeTest_STA_WithThrowsNothingAssertion, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithThrowsNothingAssertion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithFuncAssertion(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.STAThreadTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.STAThreadTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "STA_WithFuncAssertion", "STA_WithFuncAssertion", 211, - __InvokeTest_STA_WithFuncAssertion, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("STA_WithFuncAssertion", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - repeatCount: 100, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.STAThreadTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.STAThreadTests(); - } + MethodMetadata = __mm_14, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 14, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_STAThreadTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.STAThreadTests), TUnit_TestProject_STAThreadTests__TestSource.GetTests, TUnit_TestProject_STAThreadTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_STAThreadTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_STAThreadTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/StringArgumentTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/StringArgumentTests.Test.verified.txt index 51aeeac2d8..5f2b1cf67b 100644 --- a/TUnit.Core.SourceGenerator.Tests/StringArgumentTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/StringArgumentTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,72 +7,98 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_StringArgumentTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.StringArgumentTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.StringArgumentTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.StringArgumentTests); - var metadata_Normal__string = global::TUnit.Core.TestMetadataFactory.Create( - "Normal", "Normal", 8, - __InvokeTest_Normal__string, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Normal", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "s", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(""), - new global::TUnit.Core.ArgumentsAttribute(@"\"), - new global::TUnit.Core.ArgumentsAttribute(@"\t"), - new global::TUnit.Core.ArgumentsAttribute("\t"), - new global::TUnit.Core.ArgumentsAttribute("\\t"), - new global::TUnit.Core.ArgumentsAttribute("\\\t"), - new global::TUnit.Core.ArgumentsAttribute("\\\\t"), - new global::TUnit.Core.ArgumentsAttribute( """ - Hello - World - """ - ), - }, - testSessionId: testSessionId - ); - var metadata_Nullable__string_ = global::TUnit.Core.TestMetadataFactory.Create( - "Nullable", "Nullable", 27, - __InvokeTest_Nullable__string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Nullable", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.StringArgumentTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Normal", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "s", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("Nullable", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "s", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) +}); + 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 __Invoke(global::TUnit.TestProject.StringArgumentTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "s", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - new global::TUnit.Core.ArgumentsAttribute(""), - new global::TUnit.Core.ArgumentsAttribute(@"\"), - new global::TUnit.Core.ArgumentsAttribute(@"\t"), - new global::TUnit.Core.ArgumentsAttribute("\t"), - new global::TUnit.Core.ArgumentsAttribute("\\t"), - new global::TUnit.Core.ArgumentsAttribute("\\\t"), - new global::TUnit.Core.ArgumentsAttribute("\\\\t"), - new global::TUnit.Core.ArgumentsAttribute(null), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_Normal__string, metadata_Nullable__string_ }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.StringArgumentTests.Normal", - ClassName = "StringArgumentTests", MethodName = "Normal", FullyQualifiedName = "TUnit.TestProject.StringArgumentTests.Normal", FilePath = @"", @@ -82,12 +108,30 @@ internal static class TUnit_TestProject_StringArgumentTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Normal__string - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(""), + new global::TUnit.Core.ArgumentsAttribute(@"\"), + new global::TUnit.Core.ArgumentsAttribute(@"\t"), + new global::TUnit.Core.ArgumentsAttribute("\t"), + new global::TUnit.Core.ArgumentsAttribute("\\t"), + new global::TUnit.Core.ArgumentsAttribute("\\\t"), + new global::TUnit.Core.ArgumentsAttribute("\\\\t"), + new global::TUnit.Core.ArgumentsAttribute( """ + Hello + World + """ +), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.StringArgumentTests.Nullable", - ClassName = "StringArgumentTests", MethodName = "Nullable", FullyQualifiedName = "TUnit.TestProject.StringArgumentTests.Nullable", FilePath = @"", @@ -97,139 +141,27 @@ internal static class TUnit_TestProject_StringArgumentTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Nullable__string_ - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Normal__string(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Nullable__string_(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Normal__string(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.StringArgumentTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.StringArgumentTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Normal", "Normal", 8, - __InvokeTest_Normal__string, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Normal", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "s", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(""), - new global::TUnit.Core.ArgumentsAttribute(@"\"), - new global::TUnit.Core.ArgumentsAttribute(@"\t"), - new global::TUnit.Core.ArgumentsAttribute("\t"), - new global::TUnit.Core.ArgumentsAttribute("\\t"), - new global::TUnit.Core.ArgumentsAttribute("\\\t"), - new global::TUnit.Core.ArgumentsAttribute("\\\\t"), - new global::TUnit.Core.ArgumentsAttribute( """ - Hello - World - """ - ), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Nullable__string_(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.StringArgumentTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.StringArgumentTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Nullable", "Nullable", 27, - __InvokeTest_Nullable__string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Nullable", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "s", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(""), - new global::TUnit.Core.ArgumentsAttribute(@"\"), - new global::TUnit.Core.ArgumentsAttribute(@"\t"), - new global::TUnit.Core.ArgumentsAttribute("\t"), - new global::TUnit.Core.ArgumentsAttribute("\\t"), - new global::TUnit.Core.ArgumentsAttribute("\\\t"), - new global::TUnit.Core.ArgumentsAttribute("\\\\t"), - new global::TUnit.Core.ArgumentsAttribute(null), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.StringArgumentTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.StringArgumentTests(); - } + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(""), + new global::TUnit.Core.ArgumentsAttribute(@"\"), + new global::TUnit.Core.ArgumentsAttribute(@"\t"), + new global::TUnit.Core.ArgumentsAttribute("\t"), + new global::TUnit.Core.ArgumentsAttribute("\\t"), + new global::TUnit.Core.ArgumentsAttribute("\\\t"), + new global::TUnit.Core.ArgumentsAttribute("\\\\t"), + new global::TUnit.Core.ArgumentsAttribute(null), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_StringArgumentTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.StringArgumentTests), TUnit_TestProject_StringArgumentTests__TestSource.GetTests, TUnit_TestProject_StringArgumentTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_StringArgumentTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_StringArgumentTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/Tests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests.Test.verified.txt index ddfa8bbc93..aa86fb271a 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,77 +7,121 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_Bugs__1304_Tests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1304.Tests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._1304.Tests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("TryParse_InvalidString_ReturnsFailure", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "input", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Threading.CancellationToken), "cancellationToken", new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("Parse_InvalidString_ThrowsException", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "input", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("TryParse_ValidString_ReturnsAccountId", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "input", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) +}); + private static global::TUnit.TestProject.Bugs._1304.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1304.Tests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._1304.Tests); - var metadata_TryParse_InvalidString_ReturnsFailure__string__CancellationToken = global::TUnit.Core.TestMetadataFactory.Create( - "TryParse_InvalidString_ReturnsFailure", "TryParse_InvalidString_ReturnsFailure", 9, - __InvokeTest_TryParse_InvalidString_ReturnsFailure__string__CancellationToken, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("TryParse_InvalidString_ReturnsFailure", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "input", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Threading.CancellationToken), "cancellationToken", new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("\"2c48c152-7cb7-4f51-8f01-704454f36e60\""), - new global::TUnit.Core.ArgumentsAttribute("invalidNotAGui"), - new global::TUnit.Core.ArgumentsAttribute(""), - new global::TUnit.Core.ArgumentsAttribute(" "), - new global::TUnit.Core.ArgumentsAttribute(null), - }, - testSessionId: testSessionId - ); - var metadata_Parse_InvalidString_ThrowsException__string_ = global::TUnit.Core.TestMetadataFactory.Create( - "Parse_InvalidString_ThrowsException", "Parse_InvalidString_ThrowsException", 26, - __InvokeTest_Parse_InvalidString_ThrowsException__string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Parse_InvalidString_ThrowsException", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "input", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("\"2c48c152-7cb7-4f51-8f01-704454f36e60\""), - new global::TUnit.Core.ArgumentsAttribute("invalidNotAGui"), - new global::TUnit.Core.ArgumentsAttribute(""), - new global::TUnit.Core.ArgumentsAttribute(" "), - new global::TUnit.Core.ArgumentsAttribute(null), - }, - testSessionId: testSessionId - ); - var metadata_TryParse_ValidString_ReturnsAccountId__string = global::TUnit.Core.TestMetadataFactory.Create( - "TryParse_ValidString_ReturnsAccountId", "TryParse_ValidString_ReturnsAccountId", 38, - __InvokeTest_TryParse_ValidString_ReturnsAccountId__string, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("TryParse_ValidString_ReturnsAccountId", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] + return new global::TUnit.TestProject.Bugs._1304.Tests(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke(global::TUnit.TestProject.Bugs._1304.Tests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "input", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + case 2: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - new global::TUnit.Core.ArgumentsAttribute("2c48c152-7cb7-4f51-8f01-704454f36e60"), - new global::TUnit.Core.ArgumentsAttribute("00000000-0000-0000-0000-000000000000"), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_TryParse_InvalidString_ReturnsFailure__string__CancellationToken, metadata_Parse_InvalidString_ThrowsException__string_, metadata_TryParse_ValidString_ReturnsAccountId__string }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.Bugs._1304.Tests.TryParse_InvalidString_ReturnsFailure", - ClassName = "Tests", MethodName = "TryParse_InvalidString_ReturnsFailure", FullyQualifiedName = "TUnit.TestProject.Bugs._1304.Tests.TryParse_InvalidString_ReturnsFailure", FilePath = @"", @@ -87,12 +131,23 @@ internal static class TUnit_TestProject_Bugs__1304_Tests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_TryParse_InvalidString_ReturnsFailure__string__CancellationToken - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute("\"2c48c152-7cb7-4f51-8f01-704454f36e60\""), + new global::TUnit.Core.ArgumentsAttribute("invalidNotAGui"), + new global::TUnit.Core.ArgumentsAttribute(""), + new global::TUnit.Core.ArgumentsAttribute(" "), + new global::TUnit.Core.ArgumentsAttribute(null), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.Bugs._1304.Tests.Parse_InvalidString_ThrowsException", - ClassName = "Tests", MethodName = "Parse_InvalidString_ThrowsException", FullyQualifiedName = "TUnit.TestProject.Bugs._1304.Tests.Parse_InvalidString_ThrowsException", FilePath = @"", @@ -102,12 +157,23 @@ internal static class TUnit_TestProject_Bugs__1304_Tests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Parse_InvalidString_ThrowsException__string_ - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute("\"2c48c152-7cb7-4f51-8f01-704454f36e60\""), + new global::TUnit.Core.ArgumentsAttribute("invalidNotAGui"), + new global::TUnit.Core.ArgumentsAttribute(""), + new global::TUnit.Core.ArgumentsAttribute(" "), + new global::TUnit.Core.ArgumentsAttribute(null), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.Bugs._1304.Tests.TryParse_ValidString_ReturnsAccountId", - ClassName = "Tests", MethodName = "TryParse_ValidString_ReturnsAccountId", FullyQualifiedName = "TUnit.TestProject.Bugs._1304.Tests.TryParse_ValidString_ReturnsAccountId", FilePath = @"", @@ -117,178 +183,21 @@ internal static class TUnit_TestProject_Bugs__1304_Tests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_TryParse_ValidString_ReturnsAccountId__string - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_TryParse_InvalidString_ReturnsFailure__string__CancellationToken(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Parse_InvalidString_ThrowsException__string_(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_TryParse_ValidString_ReturnsAccountId__string(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_TryParse_InvalidString_ReturnsFailure__string__CancellationToken(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1304.Tests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._1304.Tests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "TryParse_InvalidString_ReturnsFailure", "TryParse_InvalidString_ReturnsFailure", 9, - __InvokeTest_TryParse_InvalidString_ReturnsFailure__string__CancellationToken, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("TryParse_InvalidString_ReturnsFailure", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "input", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Threading.CancellationToken), "cancellationToken", new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("\"2c48c152-7cb7-4f51-8f01-704454f36e60\""), - new global::TUnit.Core.ArgumentsAttribute("invalidNotAGui"), - new global::TUnit.Core.ArgumentsAttribute(""), - new global::TUnit.Core.ArgumentsAttribute(" "), - new global::TUnit.Core.ArgumentsAttribute(null), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Parse_InvalidString_ThrowsException__string_(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1304.Tests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._1304.Tests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Parse_InvalidString_ThrowsException", "Parse_InvalidString_ThrowsException", 26, - __InvokeTest_Parse_InvalidString_ThrowsException__string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Parse_InvalidString_ThrowsException", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "input", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("\"2c48c152-7cb7-4f51-8f01-704454f36e60\""), - new global::TUnit.Core.ArgumentsAttribute("invalidNotAGui"), - new global::TUnit.Core.ArgumentsAttribute(""), - new global::TUnit.Core.ArgumentsAttribute(" "), - new global::TUnit.Core.ArgumentsAttribute(null), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_TryParse_ValidString_ReturnsAccountId__string(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1304.Tests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._1304.Tests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "TryParse_ValidString_ReturnsAccountId", "TryParse_ValidString_ReturnsAccountId", 38, - __InvokeTest_TryParse_ValidString_ReturnsAccountId__string, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("TryParse_ValidString_ReturnsAccountId", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "input", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("2c48c152-7cb7-4f51-8f01-704454f36e60"), - new global::TUnit.Core.ArgumentsAttribute("00000000-0000-0000-0000-000000000000"), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.Bugs._1304.Tests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.Bugs._1304.Tests(); - } + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute("2c48c152-7cb7-4f51-8f01-704454f36e60"), + new global::TUnit.Core.ArgumentsAttribute("00000000-0000-0000-0000-000000000000"), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__1304_Tests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._1304.Tests), TUnit_TestProject_Bugs__1304_Tests__TestSource.GetTests, TUnit_TestProject_Bugs__1304_Tests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_Bugs__1304_Tests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__1304_Tests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1538.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1538.Test.verified.txt index 4add4977d4..fefca59b13 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1538.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1538.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,118 +7,120 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_Bugs__1538_Tests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1538.Tests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1538.Tests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._1538.Tests); - var metadata_Eight_Args__bool_string__string__string__string__string__string__string_ = global::TUnit.Core.TestMetadataFactory.Create( - "Eight_Args", "Eight_Args", 8, - __InvokeTest_Eight_Args__bool_string__string__string__string__string__string__string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Eight_Args", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "expectedSuccess", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "expectedError", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "expectedT0", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[2]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "expectedT1", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[3]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "expectedT2", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[4]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "expectedT3", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[5]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "expectedT4", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[6]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "expectedT5", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._1538.Tests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Eight_Args", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "expectedSuccess", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "expectedError", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[1]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "expectedT0", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[2]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "expectedT1", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[3]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "expectedT2", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[4]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "expectedT3", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[5]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "expectedT4", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[6]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "expectedT5", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("SixteenArgs", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "expectedSuccess", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item1", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[1]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item2", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[2]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item3", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[3]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item4", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[4]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item5", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[5]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item6", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[6]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item7", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[7]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item8", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[8]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item9", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[9]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item10", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[10]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item11", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[11]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item12", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[12]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item13", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[13]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item14", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[14]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item15", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) +}); + 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 __Invoke(global::TUnit.TestProject.Bugs._1538.Tests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - new global::TUnit.Core.MethodDataSourceAttribute("EightItems") + case 0: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.Bugs._1538.Tests.EightItems(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) + case 8: { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + 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); } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } + default: + throw new global::System.ArgumentException($"Expected exactly 8 arguments, but got {args.Length}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - var metadata_SixteenArgs__bool_string__string__string__string__string__string__string__string__string__string__string__string__string__string__string_ = global::TUnit.Core.TestMetadataFactory.Create( - "SixteenArgs", "SixteenArgs", 16, - __InvokeTest_SixteenArgs__bool_string__string__string__string__string__string__string__string__string__string__string__string__string__string__string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SixteenArgs", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "expectedSuccess", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item1", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item2", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[2]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item3", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[3]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item4", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[4]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item5", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[5]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item6", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[6]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item7", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[7]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item8", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[8]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item9", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[9]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item10", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[10]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item11", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[11]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item12", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[12]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item13", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[13]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item14", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[14]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item15", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("SixteenItems") + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + case 1: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.Bugs._1538.Tests.SixteenItems(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) + case 16: { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + 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); } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } + default: + throw new global::System.ArgumentException($"Expected exactly 16 arguments, but got {args.Length}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_Eight_Args__bool_string__string__string__string__string__string__string_, metadata_SixteenArgs__bool_string__string__string__string__string__string__string__string__string__string__string__string__string__string__string_ }; + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Attribute[] __Attributes(int groupIndex) { - yield return new global::TUnit.Core.TestDescriptor + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } + } + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.Bugs._1538.Tests.Eight_Args", - ClassName = "Tests", MethodName = "Eight_Args", FullyQualifiedName = "TUnit.TestProject.Bugs._1538.Tests.Eight_Args", FilePath = @"", @@ -128,12 +130,40 @@ internal static class TUnit_TestProject_Bugs__1538_Tests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Eight_Args__bool_string__string__string__string__string__string__string_ - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("EightItems") + { + Factory = (dataGeneratorMetadata) => + { + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + { + var result = global::TUnit.TestProject.Bugs._1538.Tests.EightItems(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) + { + foreach (var item in enumerable) + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + } + } + else + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } + } + return Factory(); + } + }, +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.Bugs._1538.Tests.SixteenArgs", - ClassName = "Tests", MethodName = "SixteenArgs", FullyQualifiedName = "TUnit.TestProject.Bugs._1538.Tests.SixteenArgs", FilePath = @"", @@ -143,185 +173,41 @@ internal static class TUnit_TestProject_Bugs__1538_Tests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_SixteenArgs__bool_string__string__string__string__string__string__string__string__string__string__string__string__string__string__string_ - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Eight_Args__bool_string__string__string__string__string__string__string_(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_SixteenArgs__bool_string__string__string__string__string__string__string__string__string__string__string__string__string__string__string_(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Eight_Args__bool_string__string__string__string__string__string__string_(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1538.Tests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._1538.Tests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Eight_Args", "Eight_Args", 8, - __InvokeTest_Eight_Args__bool_string__string__string__string__string__string__string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Eight_Args", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "expectedSuccess", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "expectedError", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "expectedT0", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[2]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "expectedT1", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[3]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "expectedT2", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[4]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "expectedT3", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[5]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "expectedT4", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[6]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "expectedT5", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("SixteenItems") { - new global::TUnit.Core.MethodDataSourceAttribute("EightItems") + Factory = (dataGeneratorMetadata) => { - Factory = (dataGeneratorMetadata) => + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + var result = global::TUnit.TestProject.Bugs._1538.Tests.SixteenItems(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) { - var result = global::TUnit.TestProject.Bugs._1538.Tests.EightItems(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else + foreach (var item in enumerable) { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); } } - return Factory(); - } - }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_SixteenArgs__bool_string__string__string__string__string__string__string__string__string__string__string__string__string__string__string_(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1538.Tests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._1538.Tests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "SixteenArgs", "SixteenArgs", 16, - __InvokeTest_SixteenArgs__bool_string__string__string__string__string__string__string__string__string__string__string__string__string__string__string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("SixteenArgs", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "expectedSuccess", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item1", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item2", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[2]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item3", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[3]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item4", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[4]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item5", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[5]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item6", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[6]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item7", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[7]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item8", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[8]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item9", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[9]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item10", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[10]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item11", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[11]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item12", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[12]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item13", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[13]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item14", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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()[14]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "item15", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("SixteenItems") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + else { - var result = global::TUnit.TestProject.Bugs._1538.Tests.SixteenItems(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } - return Factory(); } - }, + return Factory(); + } }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.Bugs._1538.Tests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.Bugs._1538.Tests(); - } +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__1538_Tests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._1538.Tests), TUnit_TestProject_Bugs__1538_Tests__TestSource.GetTests, TUnit_TestProject_Bugs__1538_Tests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_Bugs__1538_Tests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__1538_Tests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1539.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1539.Test.verified.txt index d260727669..87411f9021 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1539.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1539.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,34 +7,67 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_Bugs__1539_Tests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1539.Tests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1539.Tests", 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", "TestsBase`1"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._1539.Tests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Test", __classType, typeof(void), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.Bugs._1539.Tests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) + { + case 0: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._1539.Tests); - var metadata_Test = global::TUnit.Core.TestMetadataFactory.Create( - "Test", "Test", 8, - __InvokeTest_Test, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_Test }; + case 0: + { + 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) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.Bugs._1539.Tests.Test", - ClassName = "Tests", MethodName = "Test", FullyQualifiedName = "TUnit.TestProject.Bugs._1539.Tests.Test", FilePath = @"", @@ -44,61 +77,16 @@ internal static class TUnit_TestProject_Bugs__1539_Tests__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Test - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - 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::System.Threading.Tasks.ValueTask __InvokeTest_Test(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1539.Tests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._1539.Tests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Test", "Test", 8, - __InvokeTest_Test, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.Bugs._1539.Tests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.Bugs._1539.Tests(); - } + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__1539_Tests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._1539.Tests), TUnit_TestProject_Bugs__1539_Tests__TestSource.GetTests, TUnit_TestProject_Bugs__1539_Tests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_Bugs__1539_Tests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__1539_Tests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1589.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1589.Test.verified.txt index aa5d9eaf4e..886e162947 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1589.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1589.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,42 +7,67 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_Bugs__1589_MyTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1589.MyTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1589.MyTests", 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", "TestsBase`1"), - Parameters = new global::TUnit.Core.ParameterMetadata[] + global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Bugs._1589.MyFixture), "myFixture", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1589.MyFixture)), false, reflectionInfoFactory: static () => 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._1589.MyTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Test1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.Bugs._1589.MyTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) + { + case 0: { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Bugs._1589.MyFixture), "myFixture", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1589.MyFixture)), false, reflectionInfoFactory: static () => 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 - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._1589.MyTests); - var metadata_Test1 = global::TUnit.Core.TestMetadataFactory.Create( - "Test1", "Test1", 15, - __InvokeTest_Test1, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - new global::TUnit.Core.ClassDataSourceAttribute() - {Shared = global::TUnit.Core.SharedType.None,}, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_Test1 }; + case 0: + { + 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,} + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.Bugs._1589.MyTests.Test1", - ClassName = "MyTests", MethodName = "Test1", FullyQualifiedName = "TUnit.TestProject.Bugs._1589.MyTests.Test1", FilePath = @"", @@ -52,66 +77,21 @@ internal static class TUnit_TestProject_Bugs__1589_MyTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Test1 - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - 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::System.Threading.Tasks.ValueTask __InvokeTest_Test1(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test1(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1589.MyTests", 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[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Bugs._1589.MyFixture), "myFixture", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1589.MyFixture)), false, reflectionInfoFactory: static () => 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 - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._1589.MyTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Test1", "Test1", 15, - __InvokeTest_Test1, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test1", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata), - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ClassDataSourceAttribute() - {Shared = global::TUnit.Core.SharedType.None,}, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal 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])); - } + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ClassDataSourceAttribute() +{Shared = global::TUnit.Core.SharedType.None,}, +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__1589_MyTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._1589.MyTests), TUnit_TestProject_Bugs__1589_MyTests__TestSource.GetTests, TUnit_TestProject_Bugs__1589_MyTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_Bugs__1589_MyTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__1589_MyTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1594.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1594.Test.verified.txt index 60c5e3c5c3..c92411f87d 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1594.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1594.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,42 +7,68 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_Bugs__1594_MyTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1594.MyTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1594.MyTests", 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", "TestsBase`1"), - Parameters = new global::TUnit.Core.ParameterMetadata[] + global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Bugs._1594.MyFixture), "myFixture", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1594.MyFixture)), false, reflectionInfoFactory: static () => 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._1594.MyTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Test1", __classType, typeof(void), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.Bugs._1594.MyTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) + { + case 0: { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Bugs._1594.MyFixture), "myFixture", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1594.MyFixture)), false, reflectionInfoFactory: static () => 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 - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._1594.MyTests); - var metadata_Test1 = global::TUnit.Core.TestMetadataFactory.Create( - "Test1", "Test1", 15, - __InvokeTest_Test1, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test1", __classType, typeof(void), __classMetadata), - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - new global::TUnit.Core.ClassDataSourceAttribute() - {Shared = global::TUnit.Core.SharedType.None,}, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_Test1 }; + case 0: + { + 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,} + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.Bugs._1594.MyTests.Test1", - ClassName = "MyTests", MethodName = "Test1", FullyQualifiedName = "TUnit.TestProject.Bugs._1594.MyTests.Test1", FilePath = @"", @@ -52,67 +78,21 @@ internal static class TUnit_TestProject_Bugs__1594_MyTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Test1 - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - 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::System.Threading.Tasks.ValueTask __InvokeTest_Test1(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test1(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1594.MyTests", 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[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Bugs._1594.MyFixture), "myFixture", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1594.MyFixture)), false, reflectionInfoFactory: static () => 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 - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._1594.MyTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Test1", "Test1", 15, - __InvokeTest_Test1, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test1", __classType, typeof(void), __classMetadata), - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ClassDataSourceAttribute() - {Shared = global::TUnit.Core.SharedType.None,}, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal 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])); - } + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ClassDataSourceAttribute() +{Shared = global::TUnit.Core.SharedType.None,}, +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__1594_MyTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._1594.MyTests), TUnit_TestProject_Bugs__1594_MyTests__TestSource.GetTests, TUnit_TestProject_Bugs__1594_MyTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_Bugs__1594_MyTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__1594_MyTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1603.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1603.Test.verified.txt index 077057d282..369b3466f4 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1603.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1603.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,54 +7,96 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_Bugs__1603_Tests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1603.Tests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1603.Tests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._1603.Tests); - var metadata_Casted_Integer_To_Short_Converts__short = global::TUnit.Core.TestMetadataFactory.Create( - "Casted_Integer_To_Short_Converts", "Casted_Integer_To_Short_Converts", 8, - __InvokeTest_Casted_Integer_To_Short_Converts__short, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Casted_Integer_To_Short_Converts", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(short), "value", new global::TUnit.Core.ConcreteType(typeof(short)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute((short) -123), - }, - testSessionId: testSessionId - ); - var metadata_Integer_To_Short_Converts__short = global::TUnit.Core.TestMetadataFactory.Create( - "Integer_To_Short_Converts", "Integer_To_Short_Converts", 15, - __InvokeTest_Integer_To_Short_Converts__short, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Integer_To_Short_Converts", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._1603.Tests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Casted_Integer_To_Short_Converts", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(short), "value", new global::TUnit.Core.ConcreteType(typeof(short)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("Integer_To_Short_Converts", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(short), "value", new global::TUnit.Core.ConcreteType(typeof(short)), false, reflectionInfoFactory: static () => 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]) +}); + 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 __Invoke(global::TUnit.TestProject.Bugs._1603.Tests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(short), "value", new global::TUnit.Core.ConcreteType(typeof(short)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - new global::TUnit.Core.ArgumentsAttribute(-123), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_Casted_Integer_To_Short_Converts__short, metadata_Integer_To_Short_Converts__short }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.Bugs._1603.Tests.Casted_Integer_To_Short_Converts", - ClassName = "Tests", MethodName = "Casted_Integer_To_Short_Converts", FullyQualifiedName = "TUnit.TestProject.Bugs._1603.Tests.Casted_Integer_To_Short_Converts", FilePath = @"", @@ -64,12 +106,19 @@ internal static class TUnit_TestProject_Bugs__1603_Tests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Casted_Integer_To_Short_Converts__short - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute((short) -123), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.Bugs._1603.Tests.Integer_To_Short_Converts", - ClassName = "Tests", MethodName = "Integer_To_Short_Converts", FullyQualifiedName = "TUnit.TestProject.Bugs._1603.Tests.Integer_To_Short_Converts", FilePath = @"", @@ -79,119 +128,20 @@ internal static class TUnit_TestProject_Bugs__1603_Tests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Integer_To_Short_Converts__short - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Casted_Integer_To_Short_Converts__short(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Integer_To_Short_Converts__short(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Casted_Integer_To_Short_Converts__short(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1603.Tests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._1603.Tests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Casted_Integer_To_Short_Converts", "Casted_Integer_To_Short_Converts", 8, - __InvokeTest_Casted_Integer_To_Short_Converts__short, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Casted_Integer_To_Short_Converts", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(short), "value", new global::TUnit.Core.ConcreteType(typeof(short)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute((short) -123), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Integer_To_Short_Converts__short(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1603.Tests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._1603.Tests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Integer_To_Short_Converts", "Integer_To_Short_Converts", 15, - __InvokeTest_Integer_To_Short_Converts__short, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Integer_To_Short_Converts", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(short), "value", new global::TUnit.Core.ConcreteType(typeof(short)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(-123), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.Bugs._1603.Tests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.Bugs._1603.Tests(); - } + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(-123), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__1603_Tests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._1603.Tests), TUnit_TestProject_Bugs__1603_Tests__TestSource.GetTests, TUnit_TestProject_Bugs__1603_Tests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_Bugs__1603_Tests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__1603_Tests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1692.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1692.Test.verified.txt index eedbde0bd7..81588a186b 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1692.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1692.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,117 +7,97 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_Bugs__1692_Tests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1692.Tests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1692.Tests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._1692.Tests); - var metadata_NullTest__string_ = global::TUnit.Core.TestMetadataFactory.Create( - "NullTest", "NullTest", 10, - __InvokeTest_NullTest__string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("NullTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "t", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(null), - new global::TUnit.Core.ArgumentsAttribute(null), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_NullTest__string_ }; - } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.Bugs._1692.Tests.NullTest", - ClassName = "Tests", - MethodName = "NullTest", - FullyQualifiedName = "TUnit.TestProject.Bugs._1692.Tests.NullTest", - FilePath = @"", - LineNumber = 10, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_NullTest__string_ - }; - } - private static global::System.Attribute[] __CreateAttributes_0() + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._1692.Tests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("NullTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "t", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) +}); + private static global::TUnit.TestProject.Bugs._1692.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; + return new global::TUnit.TestProject.Bugs._1692.Tests(); } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_NullTest__string_(global::TUnit.TestProject.Bugs._1692.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __Invoke(global::TUnit.TestProject.Bugs._1692.Tests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) { - try + switch (methodIndex) { - switch (args.Length) + case 0: { - case 1: + try + { + switch (args.Length) { - return new global::System.Threading.Tasks.ValueTask(instance.NullTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + 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}"); } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); } } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_NullTest__string_(string testSessionId) + private static global::System.Attribute[] __Attributes(int groupIndex) { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1692.Tests", new global::TUnit.Core.ClassMetadata + switch (groupIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._1692.Tests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "NullTest", "NullTest", 10, - __InvokeTest_NullTest__string_, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("NullTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "t", new global::TUnit.Core.ConcreteType(typeof(string)), true, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(null), - new global::TUnit.Core.ArgumentsAttribute(null), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - internal static global::TUnit.TestProject.Bugs._1692.Tests CreateInstance(global::System.Type[] typeArgs, object?[] args) + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - return new global::TUnit.TestProject.Bugs._1692.Tests(); - } + new global::TUnit.Core.TestEntry + { + MethodName = "NullTest", + FullyQualifiedName = "TUnit.TestProject.Bugs._1692.Tests.NullTest", + FilePath = @"", + LineNumber = 10, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(null), + new global::TUnit.Core.ArgumentsAttribute(null), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__1692_Tests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._1692.Tests), TUnit_TestProject_Bugs__1692_Tests__TestSource.GetTests, TUnit_TestProject_Bugs__1692_Tests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_Bugs__1692_Tests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__1692_Tests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1821.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1821.Test.verified.txt index 87bb24c8f4..8fe192bafc 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1821.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1821.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,65 +7,100 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_Bugs__1821_Tests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1821.Tests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1821.Tests", 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", "TestsBase`1"), - Parameters = new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Bugs._1821.MyData), "data", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1821.MyData)), false, reflectionInfoFactory: static () => 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 - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._1821.Tests); - var metadata_MethodDataSource__string = global::TUnit.Core.TestMetadataFactory.Create( - "MethodDataSource", "MethodDataSource", 9, - __InvokeTest_MethodDataSource__string, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MethodDataSource", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.InstanceMethodDataSourceAttribute("DataSource"), - }, - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ClassDataSourceAttribute(), + global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Bugs._1821.MyData), "data", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1821.MyData)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.Bugs._1821.Tests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.Bugs._1821.MyData) })!.GetParameters()[0]) }, - testSessionId: testSessionId - ); - var metadata_MatrixDataSource__string = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixDataSource", "MatrixDataSource", 16, - __InvokeTest_MatrixDataSource__string, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixDataSource", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._1821.Tests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("MethodDataSource", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("MatrixDataSource", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) +}); + 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 __Invoke(global::TUnit.TestProject.Bugs._1821.Tests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - new global::TUnit.Core.ClassDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_MethodDataSource__string, metadata_MatrixDataSource__string }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.ClassDataSourceAttribute() + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.Bugs._1821.Tests.MethodDataSource", - ClassName = "Tests", MethodName = "MethodDataSource", FullyQualifiedName = "TUnit.TestProject.Bugs._1821.Tests.MethodDataSource", FilePath = @"", @@ -75,12 +110,23 @@ internal static class TUnit_TestProject_Bugs__1821_Tests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_MethodDataSource__string - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.InstanceMethodDataSourceAttribute("DataSource"), +}, + ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ClassDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.Bugs._1821.Tests.MatrixDataSource", - ClassName = "Tests", MethodName = "MatrixDataSource", FullyQualifiedName = "TUnit.TestProject.Bugs._1821.Tests.MatrixDataSource", FilePath = @"", @@ -90,134 +136,24 @@ internal static class TUnit_TestProject_Bugs__1821_Tests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_MatrixDataSource__string - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - 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::System.Threading.Tasks.ValueTask __InvokeTest_MethodDataSource__string(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_MatrixDataSource__string(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_MethodDataSource__string(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1821.Tests", 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[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Bugs._1821.MyData), "data", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1821.MyData)), false, reflectionInfoFactory: static () => 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 - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._1821.Tests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "MethodDataSource", "MethodDataSource", 9, - __InvokeTest_MethodDataSource__string, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MethodDataSource", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.InstanceMethodDataSourceAttribute("DataSource"), - }, - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ClassDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_MatrixDataSource__string(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1821.Tests", 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[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::TUnit.TestProject.Bugs._1821.MyData), "data", new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1821.MyData)), false, reflectionInfoFactory: static () => 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 - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._1821.Tests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixDataSource", "MatrixDataSource", 16, - __InvokeTest_MatrixDataSource__string, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixDataSource", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ClassDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal 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])); - } + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ClassDataSourceAttribute(), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__1821_Tests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._1821.Tests), TUnit_TestProject_Bugs__1821_Tests__TestSource.GetTests, TUnit_TestProject_Bugs__1821_Tests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_Bugs__1821_Tests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__1821_Tests__TestSource.Entries); } 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 3a24898825..1fa2114b14 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.DotNet10_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.DotNet10_0.verified.txt @@ -5,83 +5,26 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal static class TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource { - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1889.DerivedTest", new global::TUnit.Core.ClassMetadata { - var metadata = new global::TUnit.Core.TestMetadata - { - TestName = "Test1", - TestClassType = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), - TestMethodName = "Test1", - Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - InheritanceDepth = 1, - FilePath = @"", - LineNumber = 6, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - Type = typeof(global::TUnit.TestProject.Library.Bugs._1889.BaseTest), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Bugs._1889.BaseTest)), - Name = "Test1", - GenericTypeCount = 0, - 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", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = __CreateInstance, - InvokeTypedTest = __InvokeTest, - }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.Bugs._1889.DerivedTest.Test1", - ClassName = "DerivedTest", - MethodName = "Test1", - FullyQualifiedName = "TUnit.TestProject.Bugs._1889.DerivedTest.Test1", - FilePath = @"", - LineNumber = 6, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - 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) + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Test1", __classType, typeof(void), __classMetadata); + private static global::TUnit.TestProject.Bugs._1889.DerivedTest __CreateInstance_0(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) + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.Bugs._1889.DerivedTest instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -93,10 +36,40 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.InheritsTestsAttribute() + }; + } + public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry + { + MethodName = "Test1", + FullyQualifiedName = "TUnit.TestProject.Bugs._1889.DerivedTest.Test1", + FilePath = @"", + LineNumber = 6, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), new TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource()); + static readonly int _r_TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource.Entries_0); } @@ -109,89 +82,29 @@ internal static partial class TUnit_TestRegistration namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal static class TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_TestSource { - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata - { - TestName = "Test2", - TestClassType = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), - TestMethodName = "Test2", - Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - DataSources = new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - InheritanceDepth = 1, - FilePath = @"", - LineNumber = 6, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - Type = typeof(global::TUnit.TestProject.Library.Bugs._1889.BaseTest), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Bugs._1889.BaseTest)), - Name = "Test2", - GenericTypeCount = 0, - ReturnType = typeof(void), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), - Parameters = new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "condition", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = __CreateInstance, - InvokeTypedTest = __InvokeTest, - }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1889.DerivedTest", new global::TUnit.Core.ClassMetadata { - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.Bugs._1889.DerivedTest.Test2", - ClassName = "DerivedTest", - MethodName = "Test2", - FullyQualifiedName = "TUnit.TestProject.Bugs._1889.DerivedTest.Test2", - FilePath = @"", - LineNumber = 6, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - 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) + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Test2", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "condition", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + private static global::TUnit.TestProject.Bugs._1889.DerivedTest __CreateInstance_0(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) + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.Bugs._1889.DerivedTest instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -211,10 +124,45 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_TestS return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.MatrixDataSourceAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.InheritsTestsAttribute() + }; + } + public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry + { + MethodName = "Test2", + FullyQualifiedName = "TUnit.TestProject.Bugs._1889.DerivedTest.Test2", + FilePath = @"", + LineNumber = 6, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), new TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_TestSource()); + static readonly int _r_TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_TestSource.Entries_0); } @@ -227,90 +175,29 @@ internal static partial class TUnit_TestRegistration namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal static class TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_TestSource { - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata - { - TestName = "Test3", - TestClassType = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), - TestMethodName = "Test3", - Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - DataSources = new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(false), - new global::TUnit.Core.ArgumentsAttribute(true), - }, - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - InheritanceDepth = 1, - FilePath = @"", - LineNumber = 6, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - Type = typeof(global::TUnit.TestProject.Library.Bugs._1889.BaseTest), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Bugs._1889.BaseTest)), - Name = "Test3", - GenericTypeCount = 0, - ReturnType = typeof(void), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), - Parameters = new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "condition", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = __CreateInstance, - InvokeTypedTest = __InvokeTest, - }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.Bugs._1889.DerivedTest.Test3", - ClassName = "DerivedTest", - MethodName = "Test3", - FullyQualifiedName = "TUnit.TestProject.Bugs._1889.DerivedTest.Test3", - FilePath = @"", - LineNumber = 6, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } - private static global::System.Attribute[] __CreateAttributes() + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1889.DerivedTest", new global::TUnit.Core.ClassMetadata { - 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) + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Test3", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "condition", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + private static global::TUnit.TestProject.Bugs._1889.DerivedTest __CreateInstance_0(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) + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.Bugs._1889.DerivedTest instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -330,8 +217,45 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_TestS return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.ArgumentsAttribute(false), + new global::TUnit.Core.ArgumentsAttribute(true), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.InheritsTestsAttribute() + }; + } + public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry + { + MethodName = "Test3", + FullyQualifiedName = "TUnit.TestProject.Bugs._1889.DerivedTest.Test3", + FilePath = @"", + LineNumber = 6, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(false), + new global::TUnit.Core.ArgumentsAttribute(true), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), new TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_TestSource()); + static readonly int _r_TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_TestSource.Entries_0); } 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 3a24898825..1fa2114b14 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.DotNet8_0.verified.txt @@ -5,83 +5,26 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal static class TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource { - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1889.DerivedTest", new global::TUnit.Core.ClassMetadata { - var metadata = new global::TUnit.Core.TestMetadata - { - TestName = "Test1", - TestClassType = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), - TestMethodName = "Test1", - Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - InheritanceDepth = 1, - FilePath = @"", - LineNumber = 6, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - Type = typeof(global::TUnit.TestProject.Library.Bugs._1889.BaseTest), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Bugs._1889.BaseTest)), - Name = "Test1", - GenericTypeCount = 0, - 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", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = __CreateInstance, - InvokeTypedTest = __InvokeTest, - }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.Bugs._1889.DerivedTest.Test1", - ClassName = "DerivedTest", - MethodName = "Test1", - FullyQualifiedName = "TUnit.TestProject.Bugs._1889.DerivedTest.Test1", - FilePath = @"", - LineNumber = 6, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - 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) + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Test1", __classType, typeof(void), __classMetadata); + private static global::TUnit.TestProject.Bugs._1889.DerivedTest __CreateInstance_0(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) + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.Bugs._1889.DerivedTest instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -93,10 +36,40 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.InheritsTestsAttribute() + }; + } + public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry + { + MethodName = "Test1", + FullyQualifiedName = "TUnit.TestProject.Bugs._1889.DerivedTest.Test1", + FilePath = @"", + LineNumber = 6, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), new TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource()); + static readonly int _r_TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource.Entries_0); } @@ -109,89 +82,29 @@ internal static partial class TUnit_TestRegistration namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal static class TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_TestSource { - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata - { - TestName = "Test2", - TestClassType = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), - TestMethodName = "Test2", - Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - DataSources = new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - InheritanceDepth = 1, - FilePath = @"", - LineNumber = 6, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - Type = typeof(global::TUnit.TestProject.Library.Bugs._1889.BaseTest), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Bugs._1889.BaseTest)), - Name = "Test2", - GenericTypeCount = 0, - ReturnType = typeof(void), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), - Parameters = new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "condition", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = __CreateInstance, - InvokeTypedTest = __InvokeTest, - }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1889.DerivedTest", new global::TUnit.Core.ClassMetadata { - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.Bugs._1889.DerivedTest.Test2", - ClassName = "DerivedTest", - MethodName = "Test2", - FullyQualifiedName = "TUnit.TestProject.Bugs._1889.DerivedTest.Test2", - FilePath = @"", - LineNumber = 6, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - 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) + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Test2", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "condition", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + private static global::TUnit.TestProject.Bugs._1889.DerivedTest __CreateInstance_0(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) + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.Bugs._1889.DerivedTest instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -211,10 +124,45 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_TestS return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.MatrixDataSourceAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.InheritsTestsAttribute() + }; + } + public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry + { + MethodName = "Test2", + FullyQualifiedName = "TUnit.TestProject.Bugs._1889.DerivedTest.Test2", + FilePath = @"", + LineNumber = 6, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), new TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_TestSource()); + static readonly int _r_TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_TestSource.Entries_0); } @@ -227,90 +175,29 @@ internal static partial class TUnit_TestRegistration namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal static class TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_TestSource { - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata - { - TestName = "Test3", - TestClassType = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), - TestMethodName = "Test3", - Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - DataSources = new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(false), - new global::TUnit.Core.ArgumentsAttribute(true), - }, - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - InheritanceDepth = 1, - FilePath = @"", - LineNumber = 6, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - Type = typeof(global::TUnit.TestProject.Library.Bugs._1889.BaseTest), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Bugs._1889.BaseTest)), - Name = "Test3", - GenericTypeCount = 0, - ReturnType = typeof(void), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), - Parameters = new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "condition", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = __CreateInstance, - InvokeTypedTest = __InvokeTest, - }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.Bugs._1889.DerivedTest.Test3", - ClassName = "DerivedTest", - MethodName = "Test3", - FullyQualifiedName = "TUnit.TestProject.Bugs._1889.DerivedTest.Test3", - FilePath = @"", - LineNumber = 6, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } - private static global::System.Attribute[] __CreateAttributes() + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1889.DerivedTest", new global::TUnit.Core.ClassMetadata { - 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) + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Test3", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "condition", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + private static global::TUnit.TestProject.Bugs._1889.DerivedTest __CreateInstance_0(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) + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.Bugs._1889.DerivedTest instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -330,8 +217,45 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_TestS return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.ArgumentsAttribute(false), + new global::TUnit.Core.ArgumentsAttribute(true), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.InheritsTestsAttribute() + }; + } + public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry + { + MethodName = "Test3", + FullyQualifiedName = "TUnit.TestProject.Bugs._1889.DerivedTest.Test3", + FilePath = @"", + LineNumber = 6, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(false), + new global::TUnit.Core.ArgumentsAttribute(true), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), new TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_TestSource()); + static readonly int _r_TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_TestSource.Entries_0); } 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 3a24898825..1fa2114b14 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.DotNet9_0.verified.txt @@ -5,83 +5,26 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal static class TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource { - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1889.DerivedTest", new global::TUnit.Core.ClassMetadata { - var metadata = new global::TUnit.Core.TestMetadata - { - TestName = "Test1", - TestClassType = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), - TestMethodName = "Test1", - Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - InheritanceDepth = 1, - FilePath = @"", - LineNumber = 6, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - Type = typeof(global::TUnit.TestProject.Library.Bugs._1889.BaseTest), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Bugs._1889.BaseTest)), - Name = "Test1", - GenericTypeCount = 0, - 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", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = __CreateInstance, - InvokeTypedTest = __InvokeTest, - }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.Bugs._1889.DerivedTest.Test1", - ClassName = "DerivedTest", - MethodName = "Test1", - FullyQualifiedName = "TUnit.TestProject.Bugs._1889.DerivedTest.Test1", - FilePath = @"", - LineNumber = 6, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - 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) + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Test1", __classType, typeof(void), __classMetadata); + private static global::TUnit.TestProject.Bugs._1889.DerivedTest __CreateInstance_0(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) + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.Bugs._1889.DerivedTest instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -93,10 +36,40 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.InheritsTestsAttribute() + }; + } + public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry + { + MethodName = "Test1", + FullyQualifiedName = "TUnit.TestProject.Bugs._1889.DerivedTest.Test1", + FilePath = @"", + LineNumber = 6, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), new TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource()); + static readonly int _r_TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource.Entries_0); } @@ -109,89 +82,29 @@ internal static partial class TUnit_TestRegistration namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal static class TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_TestSource { - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata - { - TestName = "Test2", - TestClassType = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), - TestMethodName = "Test2", - Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - DataSources = new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - InheritanceDepth = 1, - FilePath = @"", - LineNumber = 6, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - Type = typeof(global::TUnit.TestProject.Library.Bugs._1889.BaseTest), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Bugs._1889.BaseTest)), - Name = "Test2", - GenericTypeCount = 0, - ReturnType = typeof(void), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), - Parameters = new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "condition", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = __CreateInstance, - InvokeTypedTest = __InvokeTest, - }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1889.DerivedTest", new global::TUnit.Core.ClassMetadata { - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.Bugs._1889.DerivedTest.Test2", - ClassName = "DerivedTest", - MethodName = "Test2", - FullyQualifiedName = "TUnit.TestProject.Bugs._1889.DerivedTest.Test2", - FilePath = @"", - LineNumber = 6, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - 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) + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Test2", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "condition", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + private static global::TUnit.TestProject.Bugs._1889.DerivedTest __CreateInstance_0(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) + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.Bugs._1889.DerivedTest instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -211,10 +124,45 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_TestS return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.MatrixDataSourceAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.InheritsTestsAttribute() + }; + } + public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry + { + MethodName = "Test2", + FullyQualifiedName = "TUnit.TestProject.Bugs._1889.DerivedTest.Test2", + FilePath = @"", + LineNumber = 6, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), new TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_TestSource()); + static readonly int _r_TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_TestSource.Entries_0); } @@ -227,90 +175,29 @@ internal static partial class TUnit_TestRegistration namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal static class TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_TestSource { - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata - { - TestName = "Test3", - TestClassType = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), - TestMethodName = "Test3", - Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - DataSources = new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(false), - new global::TUnit.Core.ArgumentsAttribute(true), - }, - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - InheritanceDepth = 1, - FilePath = @"", - LineNumber = 6, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - Type = typeof(global::TUnit.TestProject.Library.Bugs._1889.BaseTest), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Bugs._1889.BaseTest)), - Name = "Test3", - GenericTypeCount = 0, - ReturnType = typeof(void), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), - Parameters = new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "condition", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = __CreateInstance, - InvokeTypedTest = __InvokeTest, - }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.Bugs._1889.DerivedTest.Test3", - ClassName = "DerivedTest", - MethodName = "Test3", - FullyQualifiedName = "TUnit.TestProject.Bugs._1889.DerivedTest.Test3", - FilePath = @"", - LineNumber = 6, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } - private static global::System.Attribute[] __CreateAttributes() + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1889.DerivedTest", new global::TUnit.Core.ClassMetadata { - 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) + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Test3", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "condition", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + private static global::TUnit.TestProject.Bugs._1889.DerivedTest __CreateInstance_0(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) + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.Bugs._1889.DerivedTest instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -330,8 +217,45 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_TestS return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.ArgumentsAttribute(false), + new global::TUnit.Core.ArgumentsAttribute(true), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.InheritsTestsAttribute() + }; + } + public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry + { + MethodName = "Test3", + FullyQualifiedName = "TUnit.TestProject.Bugs._1889.DerivedTest.Test3", + FilePath = @"", + LineNumber = 6, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(false), + new global::TUnit.Core.ArgumentsAttribute(true), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), new TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_TestSource()); + static readonly int _r_TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_TestSource.Entries_0); } diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.Net4_7.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.Net4_7.verified.txt index c580fcd70f..4bff46e7a0 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.Net4_7.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1889.Test.Net4_7.verified.txt @@ -5,83 +5,26 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal static class TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource { - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1889.DerivedTest", new global::TUnit.Core.ClassMetadata { - var metadata = new global::TUnit.Core.TestMetadata - { - TestName = "Test1", - TestClassType = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), - TestMethodName = "Test1", - Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - InheritanceDepth = 1, - FilePath = @"", - LineNumber = 6, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - Type = typeof(global::TUnit.TestProject.Library.Bugs._1889.BaseTest), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Bugs._1889.BaseTest)), - Name = "Test1", - GenericTypeCount = 0, - 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", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = __CreateInstance, - InvokeTypedTest = __InvokeTest, - }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.Bugs._1889.DerivedTest.Test1", - ClassName = "DerivedTest", - MethodName = "Test1", - FullyQualifiedName = "TUnit.TestProject.Bugs._1889.DerivedTest.Test1", - FilePath = @"", - LineNumber = 6, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - 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) + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Test1", __classType, typeof(void), __classMetadata); + private static global::TUnit.TestProject.Bugs._1889.DerivedTest __CreateInstance_0(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) + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.Bugs._1889.DerivedTest instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -93,10 +36,40 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.InheritsTestsAttribute() + }; + } + public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry + { + MethodName = "Test1", + FullyQualifiedName = "TUnit.TestProject.Bugs._1889.DerivedTest.Test1", + FilePath = @"", + LineNumber = 6, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), new TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource()); + static readonly int _r_TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__1889_DerivedTest_Test1_TestSource.Entries_0); } @@ -109,89 +82,29 @@ internal static partial class TUnit_TestRegistration namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal static class TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_TestSource { - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata - { - TestName = "Test2", - TestClassType = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), - TestMethodName = "Test2", - Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - DataSources = new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - InheritanceDepth = 1, - FilePath = @"", - LineNumber = 6, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - Type = typeof(global::TUnit.TestProject.Library.Bugs._1889.BaseTest), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Bugs._1889.BaseTest)), - Name = "Test2", - GenericTypeCount = 0, - ReturnType = typeof(void), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), - Parameters = new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "condition", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = __CreateInstance, - InvokeTypedTest = __InvokeTest, - }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1889.DerivedTest", new global::TUnit.Core.ClassMetadata { - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.Bugs._1889.DerivedTest.Test2", - ClassName = "DerivedTest", - MethodName = "Test2", - FullyQualifiedName = "TUnit.TestProject.Bugs._1889.DerivedTest.Test2", - FilePath = @"", - LineNumber = 6, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - 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) + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Test2", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "condition", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + private static global::TUnit.TestProject.Bugs._1889.DerivedTest __CreateInstance_0(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) + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.Bugs._1889.DerivedTest instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -211,10 +124,45 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_TestS return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.MatrixDataSourceAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.InheritsTestsAttribute() + }; + } + public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry + { + MethodName = "Test2", + FullyQualifiedName = "TUnit.TestProject.Bugs._1889.DerivedTest.Test2", + FilePath = @"", + LineNumber = 6, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), new TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_TestSource()); + static readonly int _r_TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__1889_DerivedTest_Test2__bool_TestSource.Entries_0); } @@ -227,90 +175,29 @@ internal static partial class TUnit_TestRegistration namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal static class TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_TestSource { - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata - { - TestName = "Test3", - TestClassType = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), - TestMethodName = "Test3", - Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - DataSources = new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(false), - new global::TUnit.Core.ArgumentsAttribute(true), - }, - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - InheritanceDepth = 1, - FilePath = @"", - LineNumber = 6, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - Type = typeof(global::TUnit.TestProject.Library.Bugs._1889.BaseTest), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Bugs._1889.BaseTest)), - Name = "Test3", - GenericTypeCount = 0, - ReturnType = typeof(void), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), - Parameters = new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "condition", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = __CreateInstance, - InvokeTypedTest = __InvokeTest, - }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.Bugs._1889.DerivedTest.Test3", - ClassName = "DerivedTest", - MethodName = "Test3", - FullyQualifiedName = "TUnit.TestProject.Bugs._1889.DerivedTest.Test3", - FilePath = @"", - LineNumber = 6, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } - private static global::System.Attribute[] __CreateAttributes() + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1889.DerivedTest", new global::TUnit.Core.ClassMetadata { - 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) + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Test3", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "condition", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + private static global::TUnit.TestProject.Bugs._1889.DerivedTest __CreateInstance_0(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) + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.Bugs._1889.DerivedTest instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -330,8 +217,45 @@ internal sealed class TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_TestS return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.ArgumentsAttribute(false), + new global::TUnit.Core.ArgumentsAttribute(true), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.InheritsTestsAttribute() + }; + } + public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry + { + MethodName = "Test3", + FullyQualifiedName = "TUnit.TestProject.Bugs._1889.DerivedTest.Test3", + FilePath = @"", + LineNumber = 6, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(false), + new global::TUnit.Core.ArgumentsAttribute(true), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._1889.DerivedTest), new TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_TestSource()); + static readonly int _r_TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__1889_DerivedTest_Test3__bool_TestSource.Entries_0); } diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1899.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1899.Test.verified.txt index b4f15ea03e..bee5f4470d 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1899.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1899.Test.verified.txt @@ -1,87 +1,30 @@ -// +// #pragma warning disable #nullable enable namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_Bugs__1899_DerivedTest_Test1_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal static class TUnit_TestProject_Bugs__1899_DerivedTest_Test1_TestSource { - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1899.DerivedTest", new global::TUnit.Core.ClassMetadata { - var metadata = new global::TUnit.Core.TestMetadata - { - TestName = "Test1", - TestClassType = typeof(global::TUnit.TestProject.Bugs._1899.DerivedTest), - TestMethodName = "Test1", - Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - InheritanceDepth = 1, - FilePath = @"", - LineNumber = 6, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - Type = typeof(global::TUnit.TestProject.Library.Bugs._1899.BaseClass), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Bugs._1899.BaseClass)), - Name = "Test1", - GenericTypeCount = 0, - 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", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = __CreateInstance, - InvokeTypedTest = __InvokeTest, - }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.Bugs._1899.DerivedTest.Test1", - ClassName = "DerivedTest", - MethodName = "Test1", - FullyQualifiedName = "TUnit.TestProject.Bugs._1899.DerivedTest.Test1", - FilePath = @"", - LineNumber = 6, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - 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) + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._1899.DerivedTest); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Test1", __classType, typeof(void), __classMetadata); + private static global::TUnit.TestProject.Bugs._1899.DerivedTest __CreateInstance_0(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) + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.Bugs._1899.DerivedTest instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -93,8 +36,38 @@ internal sealed class TUnit_TestProject_Bugs__1899_DerivedTest_Test1_TestSource return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.InheritsTestsAttribute() + }; + } + public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry + { + MethodName = "Test1", + FullyQualifiedName = "TUnit.TestProject.Bugs._1899.DerivedTest.Test1", + FilePath = @"", + LineNumber = 6, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__1899_DerivedTest_Test1_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._1899.DerivedTest), new TUnit_TestProject_Bugs__1899_DerivedTest_Test1_TestSource()); + static readonly int _r_TUnit_TestProject_Bugs__1899_DerivedTest_Test1_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__1899_DerivedTest_Test1_TestSource.Entries_0); } diff --git a/TUnit.Core.SourceGenerator.Tests/Tests2083.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests2083.Test.verified.txt index d2cf1f8029..127d34e61b 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests2083.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests2083.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,126 +7,102 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_Bugs__2083_Tests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2083.Tests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2083.Tests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._2083.Tests); - var metadata_MyTest__long = global::TUnit.Core.TestMetadataFactory.Create( - "MyTest", "MyTest", 8, - __InvokeTest_MyTest__long, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MyTest", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(long), "value", new global::TUnit.Core.ConcreteType(typeof(long)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(0), - new global::TUnit.Core.ArgumentsAttribute((byte)255), - new global::TUnit.Core.ArgumentsAttribute((short)32767), - new global::TUnit.Core.ArgumentsAttribute('\uffff'), - new global::TUnit.Core.ArgumentsAttribute(2147483647), - new global::TUnit.Core.ArgumentsAttribute(9223372036854775807L), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_MyTest__long }; - } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.Bugs._2083.Tests.MyTest", - ClassName = "Tests", - MethodName = "MyTest", - FullyQualifiedName = "TUnit.TestProject.Bugs._2083.Tests.MyTest", - FilePath = @"", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_MyTest__long - }; - } - private static global::System.Attribute[] __CreateAttributes_0() + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._2083.Tests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("MyTest", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(long), "value", new global::TUnit.Core.ConcreteType(typeof(long)), false, reflectionInfoFactory: static () => 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]) +}); + private static global::TUnit.TestProject.Bugs._2083.Tests __CreateInstance(global::System.Type[] typeArgs, object?[] args) { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; + return new global::TUnit.TestProject.Bugs._2083.Tests(); } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_MyTest__long(global::TUnit.TestProject.Bugs._2083.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __Invoke(global::TUnit.TestProject.Bugs._2083.Tests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) { - try + switch (methodIndex) { - switch (args.Length) + case 0: { - case 1: + try + { + switch (args.Length) { - instance.MyTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); + 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}"); } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); } } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_MyTest__long(string testSessionId) + private static global::System.Attribute[] __Attributes(int groupIndex) { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2083.Tests", new global::TUnit.Core.ClassMetadata + switch (groupIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._2083.Tests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "MyTest", "MyTest", 8, - __InvokeTest_MyTest__long, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MyTest", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(long), "value", new global::TUnit.Core.ConcreteType(typeof(long)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(0), - new global::TUnit.Core.ArgumentsAttribute((byte)255), - new global::TUnit.Core.ArgumentsAttribute((short)32767), - new global::TUnit.Core.ArgumentsAttribute('\uffff'), - new global::TUnit.Core.ArgumentsAttribute(2147483647), - new global::TUnit.Core.ArgumentsAttribute(9223372036854775807L), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - internal static global::TUnit.TestProject.Bugs._2083.Tests CreateInstance(global::System.Type[] typeArgs, object?[] args) + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - return new global::TUnit.TestProject.Bugs._2083.Tests(); - } + new global::TUnit.Core.TestEntry + { + MethodName = "MyTest", + FullyQualifiedName = "TUnit.TestProject.Bugs._2083.Tests.MyTest", + FilePath = @"", + LineNumber = 8, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(0), + new global::TUnit.Core.ArgumentsAttribute((byte)255), + new global::TUnit.Core.ArgumentsAttribute((short)32767), + new global::TUnit.Core.ArgumentsAttribute('\uffff'), + new global::TUnit.Core.ArgumentsAttribute(2147483647), + new global::TUnit.Core.ArgumentsAttribute(9223372036854775807L), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__2083_Tests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._2083.Tests), TUnit_TestProject_Bugs__2083_Tests__TestSource.GetTests, TUnit_TestProject_Bugs__2083_Tests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_Bugs__2083_Tests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__2083_Tests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/Tests2085.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests2085.Test.verified.txt index 97a2f65584..28f36a3857 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests2085.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests2085.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,54 +7,96 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_Bugs__2085_Tests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2085.Tests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2085.Tests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._2085.Tests); - var metadata_Double_SpecialConsts__double = global::TUnit.Core.TestMetadataFactory.Create( - "Double_SpecialConsts", "Double_SpecialConsts", 8, - __InvokeTest_Double_SpecialConsts__double, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Double_SpecialConsts", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(double), "d", new global::TUnit.Core.ConcreteType(typeof(double)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - var metadata_Float_SpecialConsts__float = global::TUnit.Core.TestMetadataFactory.Create( - "Float_SpecialConsts", "Float_SpecialConsts", 15, - __InvokeTest_Float_SpecialConsts__float, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Float_SpecialConsts", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._2085.Tests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Double_SpecialConsts", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(double), "d", new global::TUnit.Core.ConcreteType(typeof(double)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("Float_SpecialConsts", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(float), "d", new global::TUnit.Core.ConcreteType(typeof(float)), false, reflectionInfoFactory: static () => 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]) +}); + 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 __Invoke(global::TUnit.TestProject.Bugs._2085.Tests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(float), "d", new global::TUnit.Core.ConcreteType(typeof(float)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_Double_SpecialConsts__double, metadata_Float_SpecialConsts__float }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.Bugs._2085.Tests.Double_SpecialConsts", - ClassName = "Tests", MethodName = "Double_SpecialConsts", FullyQualifiedName = "TUnit.TestProject.Bugs._2085.Tests.Double_SpecialConsts", FilePath = @"", @@ -64,12 +106,19 @@ internal static class TUnit_TestProject_Bugs__2085_Tests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Double_SpecialConsts__double - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.Bugs._2085.Tests.Float_SpecialConsts", - ClassName = "Tests", MethodName = "Float_SpecialConsts", FullyQualifiedName = "TUnit.TestProject.Bugs._2085.Tests.Float_SpecialConsts", FilePath = @"", @@ -79,119 +128,20 @@ internal static class TUnit_TestProject_Bugs__2085_Tests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Float_SpecialConsts__float - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Double_SpecialConsts__double(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Float_SpecialConsts__float(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Double_SpecialConsts__double(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2085.Tests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._2085.Tests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Double_SpecialConsts", "Double_SpecialConsts", 8, - __InvokeTest_Double_SpecialConsts__double, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Double_SpecialConsts", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(double), "d", new global::TUnit.Core.ConcreteType(typeof(double)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Float_SpecialConsts__float(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2085.Tests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._2085.Tests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Float_SpecialConsts", "Float_SpecialConsts", 15, - __InvokeTest_Float_SpecialConsts__float, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Float_SpecialConsts", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(float), "d", new global::TUnit.Core.ConcreteType(typeof(float)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.Bugs._2085.Tests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.Bugs._2085.Tests(); - } + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__2085_Tests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._2085.Tests), TUnit_TestProject_Bugs__2085_Tests__TestSource.GetTests, TUnit_TestProject_Bugs__2085_Tests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_Bugs__2085_Tests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__2085_Tests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/Tests2112.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests2112.Test.verified.txt index 6a6b944d43..66c711821c 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests2112.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests2112.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,58 +7,160 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_Bugs__2112_Tests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2112.Tests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2112.Tests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._2112.Tests); - var metadata_Test__int_long__ = global::TUnit.Core.TestMetadataFactory.Create( - "Test", "Test", 8, - __InvokeTest_Test__int_long__, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "a", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(long[]), "arr", new global::TUnit.Core.ConcreteType(typeof(long[])), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(0, 1L), - new global::TUnit.Core.ArgumentsAttribute(0, 1L), - }, - testSessionId: testSessionId - ); - var metadata_Test2__int_long__ = global::TUnit.Core.TestMetadataFactory.Create( - "Test2", "Test2", 15, - __InvokeTest_Test2__int_long__, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test2", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._2112.Tests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("Test", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "a", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(long[]), "arr", new global::TUnit.Core.ConcreteType(typeof(long[])), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("Test2", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "a", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(long[]), "arr", new global::TUnit.Core.ConcreteType(typeof(long[])), false, reflectionInfoFactory: static () => 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]) +}); + 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 __Invoke(global::TUnit.TestProject.Bugs._2112.Tests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "a", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(long[]), "arr", new global::TUnit.Core.ConcreteType(typeof(long[])), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + case 0: + { + 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)); + } + } + case 1: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - new global::TUnit.Core.ArgumentsAttribute(0, 1L, 2L, 3L), - new global::TUnit.Core.ArgumentsAttribute(0, 1L, 2L, 3L), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_Test__int_long__, metadata_Test2__int_long__ }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.Bugs._2112.Tests.Test", - ClassName = "Tests", MethodName = "Test", FullyQualifiedName = "TUnit.TestProject.Bugs._2112.Tests.Test", FilePath = @"", @@ -68,12 +170,20 @@ internal static class TUnit_TestProject_Bugs__2112_Tests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Test__int_long__ - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(0, 1L), + new global::TUnit.Core.ArgumentsAttribute(0, 1L), +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.Bugs._2112.Tests.Test2", - ClassName = "Tests", MethodName = "Test2", FullyQualifiedName = "TUnit.TestProject.Bugs._2112.Tests.Test2", FilePath = @"", @@ -83,185 +193,21 @@ internal static class TUnit_TestProject_Bugs__2112_Tests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_Test2__int_long__ - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Test__int_long__(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_Test2__int_long__(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test__int_long__(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2112.Tests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._2112.Tests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Test", "Test", 8, - __InvokeTest_Test__int_long__, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "a", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(long[]), "arr", new global::TUnit.Core.ConcreteType(typeof(long[])), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(0, 1L), - new global::TUnit.Core.ArgumentsAttribute(0, 1L), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test2__int_long__(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2112.Tests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._2112.Tests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "Test2", "Test2", 15, - __InvokeTest_Test2__int_long__, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("Test2", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "a", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(long[]), "arr", new global::TUnit.Core.ConcreteType(typeof(long[])), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(0, 1L, 2L, 3L), - new global::TUnit.Core.ArgumentsAttribute(0, 1L, 2L, 3L), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.Bugs._2112.Tests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.Bugs._2112.Tests(); - } + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(0, 1L, 2L, 3L), + new global::TUnit.Core.ArgumentsAttribute(0, 1L, 2L, 3L), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__2112_Tests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._2112.Tests), TUnit_TestProject_Bugs__2112_Tests__TestSource.GetTests, TUnit_TestProject_Bugs__2112_Tests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_Bugs__2112_Tests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__2112_Tests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/Tests2136.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests2136.Test.verified.txt index fc239a0fe7..5218871836 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests2136.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests2136.Test.verified.txt @@ -1,419 +1,155 @@ -// +// #pragma warning disable #nullable enable namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] -internal sealed class TUnit_TestProject_Bugs__2136_Tests_GenericArgumentsTest__T_string_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal static class TUnit_TestProject_Bugs__2136_Tests_GenericArgumentsTest__T_string_TestSource { - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2136.Tests", new global::TUnit.Core.ClassMetadata { - var __results = new global::System.Collections.Generic.List(); - // Create generic metadata with concrete type registrations - var genericMetadata = new global::TUnit.Core.GenericTestMetadata + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._2136.Tests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("GenericArgumentsTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, genericTypeCount: 1, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(object), "value", new global::TUnit.Core.GenericParameter(0, true, "T"), false, reflectionInfoFactory: static () => 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()[0]!), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "expected", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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]!) +}); + private static global::TUnit.TestProject.Bugs._2136.Tests __CreateInstance_0(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._2136.Tests(); + } + private static global::System.Threading.Tasks.ValueTask __Invoke_0(global::TUnit.TestProject.Bugs._2136.Tests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - TestName = "GenericArgumentsTest", - TestClassType = typeof(global::TUnit.TestProject.Bugs._2136.Tests), - TestMethodName = "GenericArgumentsTest", - Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], - DataSources = global::System.Array.Empty(), - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - InheritanceDepth = 0, - FilePath = @"", - LineNumber = 8, - MethodMetadata = new global::TUnit.Core.MethodMetadata + case 0: { - Type = typeof(global::TUnit.TestProject.Bugs._2136.Tests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2136.Tests)), - Name = "GenericArgumentsTest", - GenericTypeCount = 1, - ReturnType = typeof(global::System.Threading.Tasks.Task), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), - Parameters = new global::TUnit.Core.ParameterMetadata[] + try { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(object), "value", new global::TUnit.Core.GenericParameter(0, true, "T"), false, reflectionInfoFactory: static () => 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()[0]!), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "expected", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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", new global::TUnit.Core.ClassMetadata + return new global::System.Threading.Tasks.ValueTask(instance.GenericArgumentsTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); + } + catch (global::System.Exception ex) { - 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) => + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + case 1: { - return new global::TUnit.TestProject.Bugs._2136.Tests(); - }, - ConcreteInstantiations = new global::System.Collections.Generic.Dictionary + try + { + return new global::System.Threading.Tasks.ValueTask(instance.GenericArgumentsTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + case 2: { - [(typeof(bool).FullName ?? typeof(bool).Name)] = - new global::TUnit.Core.TestMetadata + try { - TestName = "GenericArgumentsTest", - TestClassType = typeof(global::TUnit.TestProject.Bugs._2136.Tests), - TestMethodName = "GenericArgumentsTest", - GenericMethodTypeArguments = new global::System.Type[] { typeof(bool)}, - Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.ArgumentsAttribute(true, "True"), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], - DataSources = new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(true, "True"), - }, - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - FilePath = @"", - LineNumber = 8, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._2136.Tests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2136.Tests)), - Name = "GenericArgumentsTest", - GenericTypeCount = 1, - ReturnType = typeof(global::System.Threading.Tasks.Task), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), - Parameters = new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(object), "value", new global::TUnit.Core.GenericParameter(0, true, "T"), false, reflectionInfoFactory: static () => 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()[0]!), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "expected", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.Bugs._2136.Tests(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var typedInstance = (global::TUnit.TestProject.Bugs._2136.Tests)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.GenericArgumentsTest((bool)args[0]!, (string)args[1]!)); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } + return new global::System.Threading.Tasks.ValueTask(instance.GenericArgumentsTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); } - , - [(typeof(int).FullName ?? typeof(int).Name)] = - new global::TUnit.Core.TestMetadata + catch (global::System.Exception ex) { - TestName = "GenericArgumentsTest", - TestClassType = typeof(global::TUnit.TestProject.Bugs._2136.Tests), - TestMethodName = "GenericArgumentsTest", - GenericMethodTypeArguments = new global::System.Type[] { typeof(int)}, - Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.ArgumentsAttribute(1, "1"), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], - DataSources = new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1, "1"), - }, - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - FilePath = @"", - LineNumber = 8, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._2136.Tests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2136.Tests)), - Name = "GenericArgumentsTest", - GenericTypeCount = 1, - ReturnType = typeof(global::System.Threading.Tasks.Task), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), - Parameters = new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(object), "value", new global::TUnit.Core.GenericParameter(0, true, "T"), false, reflectionInfoFactory: static () => 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()[0]!), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "expected", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.Bugs._2136.Tests(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var typedInstance = (global::TUnit.TestProject.Bugs._2136.Tests)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.GenericArgumentsTest((int)args[0]!, (string)args[1]!)); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } - , - [(typeof(double).FullName ?? typeof(double).Name)] = - new global::TUnit.Core.TestMetadata + } + case 3: + { + try + { + return new global::System.Threading.Tasks.ValueTask(instance.GenericArgumentsTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); + } + catch (global::System.Exception ex) { - TestName = "GenericArgumentsTest", - TestClassType = typeof(global::TUnit.TestProject.Bugs._2136.Tests), - TestMethodName = "GenericArgumentsTest", - GenericMethodTypeArguments = new global::System.Type[] { typeof(double)}, - Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.ArgumentsAttribute(1.1, "1.1"), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], - DataSources = new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1.1, "1.1"), - }, - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - FilePath = @"", - LineNumber = 8, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._2136.Tests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2136.Tests)), - Name = "GenericArgumentsTest", - GenericTypeCount = 1, - ReturnType = typeof(global::System.Threading.Tasks.Task), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), - Parameters = new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(object), "value", new global::TUnit.Core.GenericParameter(0, true, "T"), false, reflectionInfoFactory: static () => 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()[0]!), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "expected", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.Bugs._2136.Tests(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var typedInstance = (global::TUnit.TestProject.Bugs._2136.Tests)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.GenericArgumentsTest((double)args[0]!, (string)args[1]!)); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } - , - [(typeof(string).FullName ?? typeof(string).Name)] = - new global::TUnit.Core.TestMetadata + } + case 4: + { + try { - TestName = "GenericArgumentsTest", - TestClassType = typeof(global::TUnit.TestProject.Bugs._2136.Tests), - TestMethodName = "GenericArgumentsTest", - GenericMethodTypeArguments = new global::System.Type[] { typeof(string)}, - Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.ArgumentsAttribute("hello", "hello"), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], - DataSources = new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute("hello", "hello"), - }, - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - FilePath = @"", - LineNumber = 8, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._2136.Tests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2136.Tests)), - Name = "GenericArgumentsTest", - GenericTypeCount = 1, - ReturnType = typeof(global::System.Threading.Tasks.Task), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), - Parameters = new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(object), "value", new global::TUnit.Core.GenericParameter(0, true, "T"), false, reflectionInfoFactory: static () => 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()[0]!), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "expected", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.Bugs._2136.Tests(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var typedInstance = (global::TUnit.TestProject.Bugs._2136.Tests)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.GenericArgumentsTest((string)args[0]!, (string)args[1]!)); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } + return new global::System.Threading.Tasks.ValueTask(instance.GenericArgumentsTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); } - , - [(typeof(global::TUnit.TestProject.Bugs._2136.MyEnum).FullName ?? typeof(global::TUnit.TestProject.Bugs._2136.MyEnum).Name)] = - new global::TUnit.Core.TestMetadata + catch (global::System.Exception ex) { - TestName = "GenericArgumentsTest", - TestClassType = typeof(global::TUnit.TestProject.Bugs._2136.Tests), - TestMethodName = "GenericArgumentsTest", - GenericMethodTypeArguments = new global::System.Type[] { typeof(global::TUnit.TestProject.Bugs._2136.MyEnum)}, - Dependencies = global::System.Array.Empty(), - AttributeFactory = static () => - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.Bugs._2136.MyEnum.Item, "Item"), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ], - DataSources = new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.Bugs._2136.MyEnum.Item, "Item"), - }, - ClassDataSources = global::System.Array.Empty(), - PropertyDataSources = global::System.Array.Empty(), - PropertyInjections = global::System.Array.Empty(), - FilePath = @"", - LineNumber = 8, - InheritanceDepth = 0, - TestSessionId = testSessionId, - MethodMetadata = new global::TUnit.Core.MethodMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._2136.Tests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2136.Tests)), - Name = "GenericArgumentsTest", - GenericTypeCount = 1, - ReturnType = typeof(global::System.Threading.Tasks.Task), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), - Parameters = new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(object), "value", new global::TUnit.Core.GenericParameter(0, true, "T"), false, reflectionInfoFactory: static () => 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()[0]!), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "expected", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = static (typeArgs, args) => - { - return new global::TUnit.TestProject.Bugs._2136.Tests(); - }, - InvokeTypedTest = static (instance, args, cancellationToken) => - { - try - { - var typedInstance = (global::TUnit.TestProject.Bugs._2136.Tests)instance; - return global::TUnit.Core.AsyncConvert.Convert(() => typedInstance.GenericArgumentsTest((global::TUnit.TestProject.Bugs._2136.MyEnum)args[0]!, (string)args[1]!)); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } - , } - }; - genericMetadata.TestSessionId = testSessionId; - __results.Add(genericMetadata); - return __results; + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes_0(int groupIndex) + { + switch (groupIndex) + { + case 0: + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.ArgumentsAttribute(true, "True"), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + }; + } + case 1: + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.ArgumentsAttribute(1, "1"), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + }; + } + case 2: + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.ArgumentsAttribute(1.1, "1.1"), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + }; + } + case 3: + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.ArgumentsAttribute("hello", "hello"), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + }; + } + case 4: + { + return new global::System.Attribute[] + { + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.Bugs._2136.MyEnum.Item, "Item"), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + }; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries_0 = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.Bugs._2136.Tests.GenericArgumentsTest", - ClassName = "Tests", - MethodName = "GenericArgumentsTest", - FullyQualifiedName = "TUnit.TestProject.Bugs._2136.Tests.GenericArgumentsTest", + MethodName = "GenericArgumentsTest", + FullyQualifiedName = "TUnit.TestProject.Bugs._2136.Tests.GenericArgumentsTest", FilePath = @"", LineNumber = 8, Categories = global::System.Array.Empty(), @@ -421,11 +157,108 @@ internal sealed class TUnit_TestProject_Bugs__2136_Tests_GenericArgumentsTest__T HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 0, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(true, "True"), +}, + }, + new global::TUnit.Core.TestEntry + { + MethodName = "GenericArgumentsTest", + FullyQualifiedName = "TUnit.TestProject.Bugs._2136.Tests.GenericArgumentsTest", + FilePath = @"", + LineNumber = 8, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 1, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 1, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(1, "1"), +}, + }, + new global::TUnit.Core.TestEntry + { + MethodName = "GenericArgumentsTest", + FullyQualifiedName = "TUnit.TestProject.Bugs._2136.Tests.GenericArgumentsTest", + FilePath = @"", + LineNumber = 8, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 2, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 2, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(1.1, "1.1"), +}, + }, + new global::TUnit.Core.TestEntry + { + MethodName = "GenericArgumentsTest", + FullyQualifiedName = "TUnit.TestProject.Bugs._2136.Tests.GenericArgumentsTest", + FilePath = @"", + LineNumber = 8, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 3, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 3, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute("hello", "hello"), +}, + }, + new global::TUnit.Core.TestEntry + { + MethodName = "GenericArgumentsTest", + FullyQualifiedName = "TUnit.TestProject.Bugs._2136.Tests.GenericArgumentsTest", + FilePath = @"", + LineNumber = 8, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance_0, + InvokeBody = __Invoke_0, + MethodIndex = 4, + CreateAttributes = __Attributes_0, + AttributeGroupIndex = 4, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.Bugs._2136.MyEnum.Item, "Item"), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__2136_Tests_GenericArgumentsTest__T_string_TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._2136.Tests), new TUnit_TestProject_Bugs__2136_Tests_GenericArgumentsTest__T_string_TestSource()); + static readonly int _r_TUnit_TestProject_Bugs__2136_Tests_GenericArgumentsTest__T_string_TestSource_0 = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__2136_Tests_GenericArgumentsTest__T_string_TestSource.Entries_0); } diff --git a/TUnit.Core.SourceGenerator.Tests/Tests5118.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests5118.Test.verified.txt index fe32b0b161..9ae98644d0 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests5118.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests5118.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,60 +7,72 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_Bugs__5118_AsyncClassMethodDataSourceTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._5118.AsyncClassMethodDataSourceTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._5118.AsyncClassMethodDataSourceTests", new global::TUnit.Core.ClassMetadata + Type = typeof(global::TUnit.TestProject.Bugs._5118.AsyncClassMethodDataSourceTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._5118.AsyncClassMethodDataSourceTests)), + Name = "AsyncClassMethodDataSourceTests", + Namespace = "TUnit.TestProject.Bugs._5118", + Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), + Parameters = new global::TUnit.Core.ParameterMetadata[] { - Type = typeof(global::TUnit.TestProject.Bugs._5118.AsyncClassMethodDataSourceTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._5118.AsyncClassMethodDataSourceTests)), - Name = "AsyncClassMethodDataSourceTests", - Namespace = "TUnit.TestProject.Bugs._5118", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), - Parameters = new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "Id", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.Bugs._5118.AsyncClassMethodDataSourceTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(global::System.DateTime) })!.GetParameters()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "Name", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.Bugs._5118.AsyncClassMethodDataSourceTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(global::System.DateTime) })!.GetParameters()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.DateTime), "CreatedAt", new global::TUnit.Core.ConcreteType(typeof(global::System.DateTime)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.Bugs._5118.AsyncClassMethodDataSourceTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(global::System.DateTime) })!.GetParameters()[2]) - }, - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._5118.AsyncClassMethodDataSourceTests); - var metadata_TestWithAsyncComplexData__CancellationToken = global::TUnit.Core.TestMetadataFactory.Create( - "TestWithAsyncComplexData", "TestWithAsyncComplexData", 22, - __InvokeTest_TestWithAsyncComplexData__CancellationToken, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("TestWithAsyncComplexData", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Threading.CancellationToken), "token", new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.Bugs._5118.AsyncClassMethodDataSourceTests).GetMethod("TestWithAsyncComplexData", 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]) - }), - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "Id", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.Bugs._5118.AsyncClassMethodDataSourceTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(global::System.DateTime) })!.GetParameters()[0]), + global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "Name", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.Bugs._5118.AsyncClassMethodDataSourceTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(global::System.DateTime) })!.GetParameters()[1]), + global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.DateTime), "CreatedAt", new global::TUnit.Core.ConcreteType(typeof(global::System.DateTime)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.Bugs._5118.AsyncClassMethodDataSourceTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(global::System.DateTime) })!.GetParameters()[2]) + }, + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.Bugs._5118.AsyncClassMethodDataSourceTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("TestWithAsyncComplexData", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Threading.CancellationToken), "token", new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.Bugs._5118.AsyncClassMethodDataSourceTests).GetMethod("TestWithAsyncComplexData", 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]) +}); + private static global::TUnit.TestProject.Bugs._5118.AsyncClassMethodDataSourceTests __CreateInstance(global::System.Type[] typeArgs, object?[] args) + { + return new global::TUnit.TestProject.Bugs._5118.AsyncClassMethodDataSourceTests(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 __Invoke(global::TUnit.TestProject.Bugs._5118.AsyncClassMethodDataSourceTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - new global::TUnit.Core.MethodDataSourceAttribute("GetAsyncTestData") + case 0: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.Bugs._5118.AsyncTestDataSources.GetAsyncTestData(); - await foreach (var item in result) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - return Factory(); + return new global::System.Threading.Tasks.ValueTask(instance.TestWithAsyncComplexData(cancellationToken)); } - }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_TestWithAsyncComplexData__CancellationToken }; + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.Core.TimeoutAttribute(5000), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), + new global::TUnit.Core.MethodDataSourceAttribute("GetAsyncTestData") + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.Bugs._5118.AsyncClassMethodDataSourceTests.TestWithAsyncComplexData", - ClassName = "AsyncClassMethodDataSourceTests", MethodName = "TestWithAsyncComplexData", FullyQualifiedName = "TUnit.TestProject.Bugs._5118.AsyncClassMethodDataSourceTests.TestWithAsyncComplexData", FilePath = @"", @@ -70,84 +82,34 @@ internal static class TUnit_TestProject_Bugs__5118_AsyncClassMethodDataSourceTes HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_TestWithAsyncComplexData__CancellationToken - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.TimeoutAttribute(5000), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.MethodDataSourceAttribute("GetAsyncTestData") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_TestWithAsyncComplexData__CancellationToken(global::TUnit.TestProject.Bugs._5118.AsyncClassMethodDataSourceTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.TestWithAsyncComplexData(cancellationToken)); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_TestWithAsyncComplexData__CancellationToken(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._5118.AsyncClassMethodDataSourceTests", new global::TUnit.Core.ClassMetadata - { - Type = typeof(global::TUnit.TestProject.Bugs._5118.AsyncClassMethodDataSourceTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._5118.AsyncClassMethodDataSourceTests)), - Name = "AsyncClassMethodDataSourceTests", - Namespace = "TUnit.TestProject.Bugs._5118", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), - Parameters = new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "Id", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.Bugs._5118.AsyncClassMethodDataSourceTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(global::System.DateTime) })!.GetParameters()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "Name", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.Bugs._5118.AsyncClassMethodDataSourceTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(global::System.DateTime) })!.GetParameters()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.DateTime), "CreatedAt", new global::TUnit.Core.ConcreteType(typeof(global::System.DateTime)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.Bugs._5118.AsyncClassMethodDataSourceTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(global::System.DateTime) })!.GetParameters()[2]) - }, - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.Bugs._5118.AsyncClassMethodDataSourceTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "TestWithAsyncComplexData", "TestWithAsyncComplexData", 22, - __InvokeTest_TestWithAsyncComplexData__CancellationToken, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("TestWithAsyncComplexData", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Threading.CancellationToken), "token", new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.Bugs._5118.AsyncClassMethodDataSourceTests).GetMethod("TestWithAsyncComplexData", 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]) - }), - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("GetAsyncTestData") { - new global::TUnit.Core.MethodDataSourceAttribute("GetAsyncTestData") + Factory = (dataGeneratorMetadata) => { - Factory = (dataGeneratorMetadata) => + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + var result = global::TUnit.TestProject.Bugs._5118.AsyncTestDataSources.GetAsyncTestData(); + await foreach (var item in result) { - var result = global::TUnit.TestProject.Bugs._5118.AsyncTestDataSources.GetAsyncTestData(); - await foreach (var item in result) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); } - return Factory(); } - }, + return Factory(); + } }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.Bugs._5118.AsyncClassMethodDataSourceTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.Bugs._5118.AsyncClassMethodDataSourceTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2])); - } +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_Bugs__5118_AsyncClassMethodDataSourceTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.Bugs._5118.AsyncClassMethodDataSourceTests), TUnit_TestProject_Bugs__5118_AsyncClassMethodDataSourceTests__TestSource.GetTests, TUnit_TestProject_Bugs__5118_AsyncClassMethodDataSourceTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_Bugs__5118_AsyncClassMethodDataSourceTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_Bugs__5118_AsyncClassMethodDataSourceTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/TimeoutCancellationTokenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/TimeoutCancellationTokenTests.Test.verified.txt index 029097aafd..d325130f7b 100644 --- a/TUnit.Core.SourceGenerator.Tests/TimeoutCancellationTokenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/TimeoutCancellationTokenTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,271 +7,232 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_TimeoutCancellationTokenTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TimeoutCancellationTokenTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TimeoutCancellationTokenTests", 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[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0]) - }, - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests); - var metadata_DefaultTest__CancellationToken = global::TUnit.Core.TestMetadataFactory.Create( - "DefaultTest", "DefaultTest", 14, - __InvokeTest_DefaultTest__CancellationToken, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DefaultTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, 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", "TestsBase`1"), + Parameters = new global::TUnit.Core.ParameterMetadata[] { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Threading.CancellationToken), "cancellationToken", new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), false, reflectionInfoFactory: static () => 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]) - }), - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0]) + }, + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("DefaultTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Threading.CancellationToken), "cancellationToken", new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_1 = global::TUnit.Core.MethodMetadataFactory.Create("BasicTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Threading.CancellationToken), "cancellationToken", new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_2 = global::TUnit.Core.MethodMetadataFactory.Create("InheritedTimeoutAttribute", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Threading.CancellationToken), "cancellationToken", new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_3 = global::TUnit.Core.MethodMetadataFactory.Create("DataTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Threading.CancellationToken), "cancellationToken", new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_4 = global::TUnit.Core.MethodMetadataFactory.Create("DataSourceTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Threading.CancellationToken), "cancellationToken", new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), false, reflectionInfoFactory: static () => 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]) +}); + private static readonly global::TUnit.Core.MethodMetadata __mm_5 = global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Threading.CancellationToken), "cancellationToken", new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), false, reflectionInfoFactory: static () => 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]) +}); + 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 __Invoke(global::TUnit.TestProject.TimeoutCancellationTokenTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - new global::TUnit.Core.MethodDataSourceAttribute("DataSource") + case 0: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); + return new global::System.Threading.Tasks.ValueTask(instance.DefaultTest(cancellationToken)); } - }, - }, - testSessionId: testSessionId - ); - var metadata_BasicTest__CancellationToken = global::TUnit.Core.TestMetadataFactory.Create( - "BasicTest", "BasicTest", 21, - __InvokeTest_BasicTest__CancellationToken, __CreateAttributes_1, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("BasicTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Threading.CancellationToken), "cancellationToken", new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), false, reflectionInfoFactory: static () => 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]) - }), - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("DataSource") - { - Factory = (dataGeneratorMetadata) => + catch (global::System.Exception ex) { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } - }, - }, - testSessionId: testSessionId - ); - var metadata_InheritedTimeoutAttribute__CancellationToken = global::TUnit.Core.TestMetadataFactory.Create( - "InheritedTimeoutAttribute", "InheritedTimeoutAttribute", 30, - __InvokeTest_InheritedTimeoutAttribute__CancellationToken, __CreateAttributes_2, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("InheritedTimeoutAttribute", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Threading.CancellationToken), "cancellationToken", new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), false, reflectionInfoFactory: static () => 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]) - }), - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("DataSource") + } + case 1: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); + return new global::System.Threading.Tasks.ValueTask(instance.BasicTest(cancellationToken)); } - }, - }, - testSessionId: testSessionId - ); - var metadata_DataTest__int_CancellationToken = global::TUnit.Core.TestMetadataFactory.Create( - "DataTest", "DataTest", 38, - __InvokeTest_DataTest__int_CancellationToken, __CreateAttributes_3, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Threading.CancellationToken), "cancellationToken", new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1), - }, - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("DataSource") + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + case 2: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); + return new global::System.Threading.Tasks.ValueTask(instance.InheritedTimeoutAttribute(cancellationToken)); } - }, - }, - testSessionId: testSessionId - ); - var metadata_DataSourceTest__int_CancellationToken = global::TUnit.Core.TestMetadataFactory.Create( - "DataSourceTest", "DataSourceTest", 48, - __InvokeTest_DataSourceTest__int_CancellationToken, __CreateAttributes_4, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSourceTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Threading.CancellationToken), "cancellationToken", new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("DataSource") + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + case 3: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + var context = global::TUnit.Core.TestContext.Current; + switch (args.Length) { - var result = global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) + case 1: { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + 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)); } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); } - return Factory(); } - }, - }, - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("DataSource") + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + case 4: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + var context = global::TUnit.Core.TestContext.Current; + switch (args.Length) { - var result = global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) + case 1: { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + 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)); } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - var metadata_MatrixTest__int_CancellationToken = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixTest", "MatrixTest", 58, - __InvokeTest_MatrixTest__int_CancellationToken, __CreateAttributes_5, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Threading.CancellationToken), "cancellationToken", new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("DataSource") + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + case 5: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + var context = global::TUnit.Core.TestContext.Current; + switch (args.Length) { - var result = global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) + case 1: { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + 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)); } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_DefaultTest__CancellationToken, metadata_BasicTest__CancellationToken, metadata_InheritedTimeoutAttribute__CancellationToken, metadata_DataTest__int_CancellationToken, metadata_DataSourceTest__int_CancellationToken, metadata_MatrixTest__int_CancellationToken }; + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Attribute[] __Attributes(int groupIndex) { - yield return new global::TUnit.Core.TestDescriptor + switch (groupIndex) + { + case 0: + { + 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") + ]; + } + case 1: + { + 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") + ]; + } + case 2: + { + 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") + ]; + } + case 3: + { + 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") + ]; + } + case 4: + { + 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") + ]; + } + case 5: + { + 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") + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } + } + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.TimeoutCancellationTokenTests.DefaultTest", - ClassName = "TimeoutCancellationTokenTests", MethodName = "DefaultTest", FullyQualifiedName = "TUnit.TestProject.TimeoutCancellationTokenTests.DefaultTest", FilePath = @"", @@ -281,12 +242,40 @@ internal static class TUnit_TestProject_TimeoutCancellationTokenTests__TestSourc HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DefaultTest__CancellationToken - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("DataSource") + { + Factory = (dataGeneratorMetadata) => + { + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + { + var result = global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) + { + foreach (var item in enumerable) + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + } + } + else + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } + } + return Factory(); + } + }, +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.TimeoutCancellationTokenTests.BasicTest", - ClassName = "TimeoutCancellationTokenTests", MethodName = "BasicTest", FullyQualifiedName = "TUnit.TestProject.TimeoutCancellationTokenTests.BasicTest", FilePath = @"", @@ -296,12 +285,40 @@ internal static class TUnit_TestProject_TimeoutCancellationTokenTests__TestSourc HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_BasicTest__CancellationToken - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_1, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 1, + CreateAttributes = __Attributes, + AttributeGroupIndex = 1, + ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("DataSource") + { + Factory = (dataGeneratorMetadata) => + { + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + { + var result = global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) + { + foreach (var item in enumerable) + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + } + } + else + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } + } + return Factory(); + } + }, +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.TimeoutCancellationTokenTests.InheritedTimeoutAttribute", - ClassName = "TimeoutCancellationTokenTests", MethodName = "InheritedTimeoutAttribute", FullyQualifiedName = "TUnit.TestProject.TimeoutCancellationTokenTests.InheritedTimeoutAttribute", FilePath = @"", @@ -311,12 +328,40 @@ internal static class TUnit_TestProject_TimeoutCancellationTokenTests__TestSourc HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_InheritedTimeoutAttribute__CancellationToken - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_2, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 2, + CreateAttributes = __Attributes, + AttributeGroupIndex = 2, + ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("DataSource") + { + Factory = (dataGeneratorMetadata) => + { + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + { + var result = global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) + { + foreach (var item in enumerable) + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + } + } + else + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } + } + return Factory(); + } + }, +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.TimeoutCancellationTokenTests.DataTest", - ClassName = "TimeoutCancellationTokenTests", MethodName = "DataTest", FullyQualifiedName = "TUnit.TestProject.TimeoutCancellationTokenTests.DataTest", FilePath = @"", @@ -326,12 +371,44 @@ internal static class TUnit_TestProject_TimeoutCancellationTokenTests__TestSourc HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataTest__int_CancellationToken - }; - yield return new global::TUnit.Core.TestDescriptor + MethodMetadata = __mm_3, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 3, + CreateAttributes = __Attributes, + AttributeGroupIndex = 3, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(1), +}, + ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("DataSource") + { + Factory = (dataGeneratorMetadata) => + { + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + { + var result = global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) + { + foreach (var item in enumerable) + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); + } + } + else + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } + } + return Factory(); + } + }, +}, + }, + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.TimeoutCancellationTokenTests.DataSourceTest", - ClassName = "TimeoutCancellationTokenTests", MethodName = "DataSourceTest", FullyQualifiedName = "TUnit.TestProject.TimeoutCancellationTokenTests.DataSourceTest", FilePath = @"", @@ -341,546 +418,115 @@ internal static class TUnit_TestProject_TimeoutCancellationTokenTests__TestSourc HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSourceTest__int_CancellationToken - }; - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.TimeoutCancellationTokenTests.MatrixTest", - ClassName = "TimeoutCancellationTokenTests", - MethodName = "MatrixTest", - FullyQualifiedName = "TUnit.TestProject.TimeoutCancellationTokenTests.MatrixTest", - FilePath = @"", - LineNumber = 58, - Categories = new string[] { "Blah", "Timeout Cancellation Token Tests" }, - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_MatrixTest__int_CancellationToken - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - 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::System.Attribute[] __CreateAttributes_1() - { - 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::System.Attribute[] __CreateAttributes_2() - { - 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::System.Attribute[] __CreateAttributes_3() - { - 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::System.Attribute[] __CreateAttributes_4() - { - 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::System.Attribute[] __CreateAttributes_5() - { - 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::System.Threading.Tasks.ValueTask __InvokeTest_DefaultTest__CancellationToken(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_BasicTest__CancellationToken(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_InheritedTimeoutAttribute__CancellationToken(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataTest__int_CancellationToken(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSourceTest__int_CancellationToken(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)); - } - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_MatrixTest__int_CancellationToken(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DefaultTest__CancellationToken(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TimeoutCancellationTokenTests", 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[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0]) - }, - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DefaultTest", "DefaultTest", 14, - __InvokeTest_DefaultTest__CancellationToken, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DefaultTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Threading.CancellationToken), "cancellationToken", new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), false, reflectionInfoFactory: static () => 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]) - }), - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] + MethodMetadata = __mm_4, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 4, + CreateAttributes = __Attributes, + AttributeGroupIndex = 4, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("DataSource") { - new global::TUnit.Core.MethodDataSourceAttribute("DataSource") + Factory = (dataGeneratorMetadata) => { - Factory = (dataGeneratorMetadata) => + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + var result = global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) { - var result = global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) + foreach (var item in enumerable) { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); } } - return Factory(); - } - }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_BasicTest__CancellationToken(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TimeoutCancellationTokenTests", 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[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0]) - }, - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "BasicTest", "BasicTest", 21, - __InvokeTest_BasicTest__CancellationToken, __CreateAttributes_1, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("BasicTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Threading.CancellationToken), "cancellationToken", new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), false, reflectionInfoFactory: static () => 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]) - }), - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("DataSource") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + else { - var result = global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } - return Factory(); } - }, + return Factory(); + } }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_InheritedTimeoutAttribute__CancellationToken(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TimeoutCancellationTokenTests", 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[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0]) - }, - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "InheritedTimeoutAttribute", "InheritedTimeoutAttribute", 30, - __InvokeTest_InheritedTimeoutAttribute__CancellationToken, __CreateAttributes_2, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("InheritedTimeoutAttribute", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Threading.CancellationToken), "cancellationToken", new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), false, reflectionInfoFactory: static () => 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]) - }), - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] +}, + ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("DataSource") { - new global::TUnit.Core.MethodDataSourceAttribute("DataSource") + Factory = (dataGeneratorMetadata) => { - Factory = (dataGeneratorMetadata) => + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + var result = global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) { - var result = global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else + foreach (var item in enumerable) { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); } } - return Factory(); - } - }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataTest__int_CancellationToken(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TimeoutCancellationTokenTests", 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[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0]) - }, - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataTest", "DataTest", 38, - __InvokeTest_DataTest__int_CancellationToken, __CreateAttributes_3, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Threading.CancellationToken), "cancellationToken", new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1), - }, - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("DataSource") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + else { - var result = global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } - return Factory(); } - }, + return Factory(); + } }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSourceTest__int_CancellationToken(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TimeoutCancellationTokenTests", new global::TUnit.Core.ClassMetadata +}, + }, + new global::TUnit.Core.TestEntry { - 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[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0]) - }, - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSourceTest", "DataSourceTest", 48, - __InvokeTest_DataSourceTest__int_CancellationToken, __CreateAttributes_4, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSourceTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Threading.CancellationToken), "cancellationToken", new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + MethodName = "MatrixTest", + FullyQualifiedName = "TUnit.TestProject.TimeoutCancellationTokenTests.MatrixTest", + FilePath = @"", + LineNumber = 58, + Categories = new string[] { "Blah", "Timeout Cancellation Token Tests" }, + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_5, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 5, + CreateAttributes = __Attributes, + AttributeGroupIndex = 5, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MatrixDataSourceAttribute(), +}, + ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("DataSource") { - new global::TUnit.Core.MethodDataSourceAttribute("DataSource") + Factory = (dataGeneratorMetadata) => { - Factory = (dataGeneratorMetadata) => + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + var result = global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) { - var result = global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else + foreach (var item in enumerable) { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); } } - return Factory(); - } - }, - }, - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("DataSource") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + else { - var result = global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_MatrixTest__int_CancellationToken(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TimeoutCancellationTokenTests", 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[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0]) - }, - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "MatrixTest", "MatrixTest", 58, - __InvokeTest_MatrixTest__int_CancellationToken, __CreateAttributes_5, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("MatrixTest", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Threading.CancellationToken), "cancellationToken", new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), + return Factory(); + } }, - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("DataSource") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); - } +}, }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal 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])); - } + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_TimeoutCancellationTokenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), TUnit_TestProject_TimeoutCancellationTokenTests__TestSource.GetTests, TUnit_TestProject_TimeoutCancellationTokenTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_TimeoutCancellationTokenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_TimeoutCancellationTokenTests__TestSource.Entries); } @@ -895,65 +541,71 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_TimeoutDoesNotFireTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TimeoutDoesNotFireTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TimeoutDoesNotFireTests", 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", "TestsBase`1"), - Parameters = new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.TimeoutDoesNotFireTests).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0]) - }, - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.TimeoutDoesNotFireTests); - var metadata_QuickTestDoesNotTimeout__CancellationToken = global::TUnit.Core.TestMetadataFactory.Create( - "QuickTestDoesNotTimeout", "QuickTestDoesNotTimeout", 86, - __InvokeTest_QuickTestDoesNotTimeout__CancellationToken, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("QuickTestDoesNotTimeout", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Threading.CancellationToken), "cancellationToken", new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), false, reflectionInfoFactory: static () => 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]) - }), - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.TimeoutDoesNotFireTests).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0]) + }, + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.TimeoutDoesNotFireTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("QuickTestDoesNotTimeout", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Threading.CancellationToken), "cancellationToken", new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), false, reflectionInfoFactory: static () => 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]) +}); + 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 __Invoke(global::TUnit.TestProject.TimeoutDoesNotFireTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - new global::TUnit.Core.MethodDataSourceAttribute("DataSource") + case 0: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.TimeoutDoesNotFireTests.DataSource(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); + return new global::System.Threading.Tasks.ValueTask(instance.QuickTestDoesNotTimeout(cancellationToken)); } - }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_QuickTestDoesNotTimeout__CancellationToken }; + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Attribute[] __Attributes(int groupIndex) { - yield return new global::TUnit.Core.TestDescriptor + switch (groupIndex) + { + case 0: + { + 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") + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } + } + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] + { + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.TimeoutDoesNotFireTests.QuickTestDoesNotTimeout", - ClassName = "TimeoutDoesNotFireTests", MethodName = "QuickTestDoesNotTimeout", FullyQualifiedName = "TUnit.TestProject.TimeoutDoesNotFireTests.QuickTestDoesNotTimeout", FilePath = @"", @@ -963,92 +615,43 @@ internal static class TUnit_TestProject_TimeoutDoesNotFireTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_QuickTestDoesNotTimeout__CancellationToken - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - 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::System.Threading.Tasks.ValueTask __InvokeTest_QuickTestDoesNotTimeout__CancellationToken(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_QuickTestDoesNotTimeout__CancellationToken(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TimeoutDoesNotFireTests", 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[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.TimeoutDoesNotFireTests).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0]) - }, - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.TimeoutDoesNotFireTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "QuickTestDoesNotTimeout", "QuickTestDoesNotTimeout", 86, - __InvokeTest_QuickTestDoesNotTimeout__CancellationToken, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("QuickTestDoesNotTimeout", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Threading.CancellationToken), "cancellationToken", new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), false, reflectionInfoFactory: static () => 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]) - }), - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("DataSource") { - new global::TUnit.Core.MethodDataSourceAttribute("DataSource") + Factory = (dataGeneratorMetadata) => { - Factory = (dataGeneratorMetadata) => + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + var result = global::TUnit.TestProject.TimeoutDoesNotFireTests.DataSource(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) { - var result = global::TUnit.TestProject.TimeoutDoesNotFireTests.DataSource(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else + foreach (var item in enumerable) { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); } } - return Factory(); + else + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } } - }, + return Factory(); + } }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal 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])); - } +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_TimeoutDoesNotFireTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.TimeoutDoesNotFireTests), TUnit_TestProject_TimeoutDoesNotFireTests__TestSource.GetTests, TUnit_TestProject_TimeoutDoesNotFireTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_TimeoutDoesNotFireTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_TimeoutDoesNotFireTests__TestSource.Entries); } @@ -1063,65 +666,71 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_CancellationTokenTriggeredTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.CancellationTokenTriggeredTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.CancellationTokenTriggeredTests", 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", "TestsBase`1"), - Parameters = new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.CancellationTokenTriggeredTests).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0]) - }, - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.CancellationTokenTriggeredTests); - var metadata_CancellationTokenIsTriggered__CancellationToken = global::TUnit.Core.TestMetadataFactory.Create( - "CancellationTokenIsTriggered", "CancellationTokenIsTriggered", 106, - __InvokeTest_CancellationTokenIsTriggered__CancellationToken, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("CancellationTokenIsTriggered", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Threading.CancellationToken), "cancellationToken", new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), false, reflectionInfoFactory: static () => 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]) - }), - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] + global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.CancellationTokenTriggeredTests).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0]) + }, + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.CancellationTokenTriggeredTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("CancellationTokenIsTriggered", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Threading.CancellationToken), "cancellationToken", new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), false, reflectionInfoFactory: static () => 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]) +}); + 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 __Invoke(global::TUnit.TestProject.CancellationTokenTriggeredTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - new global::TUnit.Core.MethodDataSourceAttribute("DataSource") + case 0: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.CancellationTokenTriggeredTests.DataSource(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - } - return Factory(); + return new global::System.Threading.Tasks.ValueTask(instance.CancellationTokenIsTriggered(cancellationToken)); } - }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_CancellationTokenIsTriggered__CancellationToken }; + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) + { + case 0: + { + 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") + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.CancellationTokenTriggeredTests.CancellationTokenIsTriggered", - ClassName = "CancellationTokenTriggeredTests", MethodName = "CancellationTokenIsTriggered", FullyQualifiedName = "TUnit.TestProject.CancellationTokenTriggeredTests.CancellationTokenIsTriggered", FilePath = @"", @@ -1131,90 +740,41 @@ internal static class TUnit_TestProject_CancellationTokenTriggeredTests__TestSou HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_CancellationTokenIsTriggered__CancellationToken - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - 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::System.Threading.Tasks.ValueTask __InvokeTest_CancellationTokenIsTriggered__CancellationToken(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_CancellationTokenIsTriggered__CancellationToken(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.CancellationTokenTriggeredTests", 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[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => typeof(global::TUnit.TestProject.CancellationTokenTriggeredTests).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0]) - }, - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.CancellationTokenTriggeredTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "CancellationTokenIsTriggered", "CancellationTokenIsTriggered", 106, - __InvokeTest_CancellationTokenIsTriggered__CancellationToken, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("CancellationTokenIsTriggered", __classType, typeof(global::System.Threading.Tasks.Task), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(global::System.Threading.CancellationToken), "cancellationToken", new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), false, reflectionInfoFactory: static () => 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]) - }), - classDataSources: new global::TUnit.Core.IDataSourceAttribute[] + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("DataSource") { - new global::TUnit.Core.MethodDataSourceAttribute("DataSource") + Factory = (dataGeneratorMetadata) => { - Factory = (dataGeneratorMetadata) => + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + var result = global::TUnit.TestProject.CancellationTokenTriggeredTests.DataSource(); + if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) { - var result = global::TUnit.TestProject.CancellationTokenTriggeredTests.DataSource(); - if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) - { - foreach (var item in enumerable) - { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); - } - } - else + foreach (var item in enumerable) { - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(item)); } } - return Factory(); + else + { + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + } } - }, + return Factory(); + } }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal 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])); - } +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_CancellationTokenTriggeredTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.CancellationTokenTriggeredTests), TUnit_TestProject_CancellationTokenTriggeredTests__TestSource.GetTests, TUnit_TestProject_CancellationTokenTriggeredTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_CancellationTokenTriggeredTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_CancellationTokenTriggeredTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/TupleDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/TupleDataSourceDrivenTests.Test.verified.txt index 046b1445d0..b410d7d924 100644 --- a/TUnit.Core.SourceGenerator.Tests/TupleDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/TupleDataSourceDrivenTests.Test.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,54 +7,76 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_TupleDataSourceDrivenTests__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TupleDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TupleDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests); - var metadata_DataSource_TupleMethod__int_string_bool = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_TupleMethod", "DataSource_TupleMethod", 8, - __InvokeTest_DataSource_TupleMethod__int_string_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_TupleMethod", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("DataSource_TupleMethod", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[1]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) +}); + 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 __Invoke(global::TUnit.TestProject.TupleDataSourceDrivenTests instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) { - new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") + case 0: { - Factory = (dataGeneratorMetadata) => + try { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + switch (args.Length) { - var result = global::TUnit.TestProject.TupleDataSourceDrivenTests.TupleMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); + 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}"); } - return Factory(); } - }, - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_DataSource_TupleMethod__int_string_bool }; + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) + { + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute(), + new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.TupleDataSourceDrivenTests.DataSource_TupleMethod", - ClassName = "TupleDataSourceDrivenTests", MethodName = "DataSource_TupleMethod", FullyQualifiedName = "TUnit.TestProject.TupleDataSourceDrivenTests.DataSource_TupleMethod", FilePath = @"", @@ -64,85 +86,31 @@ internal static class TUnit_TestProject_TupleDataSourceDrivenTests__TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_DataSource_TupleMethod__int_string_bool - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_TupleMethod__int_string_bool(global::TUnit.TestProject.TupleDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") { - try + Factory = (dataGeneratorMetadata) => { - switch (args.Length) + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - 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}"); + var result = global::TUnit.TestProject.TupleDataSourceDrivenTests.TupleMethod(); + yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); } + return Factory(); } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_TupleMethod__int_string_bool(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TupleDataSourceDrivenTests", 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", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "DataSource_TupleMethod", "DataSource_TupleMethod", 8, - __InvokeTest_DataSource_TupleMethod__int_string_bool, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("DataSource_TupleMethod", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "value", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(string), "value2", new global::TUnit.Core.ConcreteType(typeof(string)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(bool), "value3", new global::TUnit.Core.ConcreteType(typeof(bool)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") - { - Factory = (dataGeneratorMetadata) => - { - async global::System.Collections.Generic.IAsyncEnumerable>> Factory() - { - var result = global::TUnit.TestProject.TupleDataSourceDrivenTests.TupleMethod(); - yield return () => global::System.Threading.Tasks.Task.FromResult(global::TUnit.Core.Helpers.DataSourceHelpers.ToObjectArray(result)); - } - return Factory(); - } - }, }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.TupleDataSourceDrivenTests CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.TupleDataSourceDrivenTests(); - } +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_TupleDataSourceDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), TUnit_TestProject_TupleDataSourceDrivenTests__TestSource.GetTests, TUnit_TestProject_TupleDataSourceDrivenTests__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_TupleDataSourceDrivenTests__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_TupleDataSourceDrivenTests__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_AotSafeDataSourceFactories.verified.txt b/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_AotSafeDataSourceFactories.verified.txt index d5915a94e7..8f718c9ae4 100644 --- a/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_AotSafeDataSourceFactories.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_AotSafeDataSourceFactories.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,121 +7,99 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_AotDataSourceTest__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("UnifiedReflectionFreeTests:global::TUnit.TestProject.AotDataSourceTest", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("UnifiedReflectionFreeTests:global::TUnit.TestProject.AotDataSourceTest", 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", "UnifiedReflectionFreeTests"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.AotDataSourceTest); - var metadata_TestWithDataSource__int_int_int = global::TUnit.Core.TestMetadataFactory.Create( - "TestWithDataSource", "TestWithDataSource", 7, - __InvokeTest_TestWithDataSource__int_int_int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("TestWithDataSource", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "a", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "b", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "c", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1, 2, 3), - new global::TUnit.Core.ArgumentsAttribute(4, 5, 6), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_TestWithDataSource__int_int_int }; - } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor - { - TestId = "TUnit.TestProject.AotDataSourceTest.TestWithDataSource", - ClassName = "AotDataSourceTest", - MethodName = "TestWithDataSource", - FullyQualifiedName = "TUnit.TestProject.AotDataSourceTest.TestWithDataSource", - FilePath = @"", - LineNumber = 7, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_TestWithDataSource__int_int_int - }; - } - private static global::System.Attribute[] __CreateAttributes_0() + 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 + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.AotDataSourceTest); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("TestWithDataSource", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] +{ +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "a", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "b", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[1]), +global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "c", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) +}); + private static global::TUnit.TestProject.AotDataSourceTest __CreateInstance(global::System.Type[] typeArgs, object?[] args) { - return - [ - new global::TUnit.Core.TestAttribute() - ]; + return new global::TUnit.TestProject.AotDataSourceTest(); } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_TestWithDataSource__int_int_int(global::TUnit.TestProject.AotDataSourceTest instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __Invoke(global::TUnit.TestProject.AotDataSourceTest instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) { - try + switch (methodIndex) { - switch (args.Length) + case 0: { - case 3: + try + { + switch (args.Length) { - 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); + 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}"); } - 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)); + } } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); } } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_TestWithDataSource__int_int_int(string testSessionId) + private static global::System.Attribute[] __Attributes(int groupIndex) { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("UnifiedReflectionFreeTests:global::TUnit.TestProject.AotDataSourceTest", new global::TUnit.Core.ClassMetadata + switch (groupIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.AotDataSourceTest); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "TestWithDataSource", "TestWithDataSource", 7, - __InvokeTest_TestWithDataSource__int_int_int, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("TestWithDataSource", __classType, typeof(void), __classMetadata, parameters: new global::TUnit.Core.ParameterMetadata[] - { - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "a", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[0]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "b", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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()[1]), - global::TUnit.Core.ParameterMetadataFactory.Create(typeof(int), "c", new global::TUnit.Core.ConcreteType(typeof(int)), false, reflectionInfoFactory: static () => 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]) - }), - dataSources: new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.ArgumentsAttribute(1, 2, 3), - new global::TUnit.Core.ArgumentsAttribute(4, 5, 6), - }, - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - internal static global::TUnit.TestProject.AotDataSourceTest CreateInstance(global::System.Type[] typeArgs, object?[] args) + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - return new global::TUnit.TestProject.AotDataSourceTest(); - } + new global::TUnit.Core.TestEntry + { + MethodName = "TestWithDataSource", + FullyQualifiedName = "TUnit.TestProject.AotDataSourceTest.TestWithDataSource", + FilePath = @"", + LineNumber = 7, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + TestDataSources = new global::TUnit.Core.IDataSourceAttribute[] +{ + new global::TUnit.Core.ArgumentsAttribute(1, 2, 3), + new global::TUnit.Core.ArgumentsAttribute(4, 5, 6), +}, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_AotDataSourceTest__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.AotDataSourceTest), TUnit_TestProject_AotDataSourceTest__TestSource.GetTests, TUnit_TestProject_AotDataSourceTest__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_AotDataSourceTest__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_AotDataSourceTest__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_ConfigurationSupport.verified.txt b/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_ConfigurationSupport.verified.txt index c4a558c435..851acb0381 100644 --- a/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_ConfigurationSupport.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_ConfigurationSupport.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,34 +7,62 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_ConfigurationTest__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("UnifiedReflectionFreeTests:global::TUnit.TestProject.ConfigurationTest", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("UnifiedReflectionFreeTests:global::TUnit.TestProject.ConfigurationTest", 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", "UnifiedReflectionFreeTests"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.ConfigurationTest); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("TestWithConfiguration", __classType, typeof(void), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.ConfigurationTest instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) + { + case 0: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.ConfigurationTest); - var metadata_TestWithConfiguration = global::TUnit.Core.TestMetadataFactory.Create( - "TestWithConfiguration", "TestWithConfiguration", 7, - __InvokeTest_TestWithConfiguration, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("TestWithConfiguration", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_TestWithConfiguration }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.ConfigurationTest.TestWithConfiguration", - ClassName = "ConfigurationTest", MethodName = "TestWithConfiguration", FullyQualifiedName = "TUnit.TestProject.ConfigurationTest.TestWithConfiguration", FilePath = @"", @@ -44,56 +72,16 @@ internal static class TUnit_TestProject_ConfigurationTest__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_TestWithConfiguration - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_TestWithConfiguration(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_TestWithConfiguration(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("UnifiedReflectionFreeTests:global::TUnit.TestProject.ConfigurationTest", 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", "UnifiedReflectionFreeTests"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.ConfigurationTest); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "TestWithConfiguration", "TestWithConfiguration", 7, - __InvokeTest_TestWithConfiguration, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("TestWithConfiguration", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.ConfigurationTest CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.ConfigurationTest(); - } + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_ConfigurationTest__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.ConfigurationTest), TUnit_TestProject_ConfigurationTest__TestSource.GetTests, TUnit_TestProject_ConfigurationTest__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_ConfigurationTest__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_ConfigurationTest__TestSource.Entries); } 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 e78ca37cd1..4576b480eb 100644 --- a/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_ModuleInitializer_Generation.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_ModuleInitializer_Generation.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,34 +7,62 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_ModuleInitializerTest__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("UnifiedReflectionFreeTests:global::TUnit.TestProject.ModuleInitializerTest", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("UnifiedReflectionFreeTests:global::TUnit.TestProject.ModuleInitializerTest", 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", "UnifiedReflectionFreeTests"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.ModuleInitializerTest); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("TestWithModuleInit", __classType, typeof(void), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.ModuleInitializerTest instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) + { + case 0: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.ModuleInitializerTest); - var metadata_TestWithModuleInit = global::TUnit.Core.TestMetadataFactory.Create( - "TestWithModuleInit", "TestWithModuleInit", 8, - __InvokeTest_TestWithModuleInit, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("TestWithModuleInit", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_TestWithModuleInit }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.ModuleInitializerTest.TestWithModuleInit", - ClassName = "ModuleInitializerTest", MethodName = "TestWithModuleInit", FullyQualifiedName = "TUnit.TestProject.ModuleInitializerTest.TestWithModuleInit", FilePath = @"", @@ -44,56 +72,16 @@ internal static class TUnit_TestProject_ModuleInitializerTest__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_TestWithModuleInit - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_TestWithModuleInit(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_TestWithModuleInit(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("UnifiedReflectionFreeTests:global::TUnit.TestProject.ModuleInitializerTest", 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", "UnifiedReflectionFreeTests"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.ModuleInitializerTest); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "TestWithModuleInit", "TestWithModuleInit", 8, - __InvokeTest_TestWithModuleInit, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("TestWithModuleInit", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.ModuleInitializerTest CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.ModuleInitializerTest(); - } + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_ModuleInitializerTest__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.ModuleInitializerTest), TUnit_TestProject_ModuleInitializerTest__TestSource.GetTests, TUnit_TestProject_ModuleInitializerTest__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_ModuleInitializerTest__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_ModuleInitializerTest__TestSource.Entries); } 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 30413c9c07..e31a63a053 100644 --- a/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_StronglyTypedDelegates_Generation.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_StronglyTypedDelegates_Generation.verified.txt @@ -1,4 +1,4 @@ -// +// #pragma warning disable #nullable enable @@ -7,34 +7,62 @@ namespace TUnit.Generated; [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "VERSION_SCRUBBED")] internal static class TUnit_TestProject_TypedDelegateTest__TestSource { - public static global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static readonly global::TUnit.Core.ClassMetadata __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("UnifiedReflectionFreeTests:global::TUnit.TestProject.TypedDelegateTest", new global::TUnit.Core.ClassMetadata { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("UnifiedReflectionFreeTests:global::TUnit.TestProject.TypedDelegateTest", 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", "UnifiedReflectionFreeTests"), + Parameters = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + Parent = null + }); + private static readonly global::System.Type __classType = typeof(global::TUnit.TestProject.TypedDelegateTest); + private static readonly global::TUnit.Core.MethodMetadata __mm_0 = global::TUnit.Core.MethodMetadataFactory.Create("TestWithDelegate", __classType, typeof(void), __classMetadata); + 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 __Invoke(global::TUnit.TestProject.TypedDelegateTest instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + switch (methodIndex) + { + case 0: + { + 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)); + } + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex)); + } + } + private static global::System.Attribute[] __Attributes(int groupIndex) + { + switch (groupIndex) { - 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 - }); - var __classType = typeof(global::TUnit.TestProject.TypedDelegateTest); - var metadata_TestWithDelegate = global::TUnit.Core.TestMetadataFactory.Create( - "TestWithDelegate", "TestWithDelegate", 7, - __InvokeTest_TestWithDelegate, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("TestWithDelegate", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata_TestWithDelegate }; + case 0: + { + return + [ + new global::TUnit.Core.TestAttribute() + ]; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex)); + } } - public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + public static readonly global::TUnit.Core.TestEntry[] Entries = new global::TUnit.Core.TestEntry[] { - yield return new global::TUnit.Core.TestDescriptor + new global::TUnit.Core.TestEntry { - TestId = "TUnit.TestProject.TypedDelegateTest.TestWithDelegate", - ClassName = "TypedDelegateTest", MethodName = "TestWithDelegate", FullyQualifiedName = "TUnit.TestProject.TypedDelegateTest.TestWithDelegate", FilePath = @"", @@ -44,56 +72,16 @@ internal static class TUnit_TestProject_TypedDelegateTest__TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = __Materialize_TestWithDelegate - }; - } - private static global::System.Attribute[] __CreateAttributes_0() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest_TestWithDelegate(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)); - } - } - private static global::System.Collections.Generic.IReadOnlyList __Materialize_TestWithDelegate(string testSessionId) - { - var __classMetadata = global::TUnit.Core.ClassMetadata.GetOrAdd("UnifiedReflectionFreeTests:global::TUnit.TestProject.TypedDelegateTest", 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", "UnifiedReflectionFreeTests"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }); - var __classType = typeof(global::TUnit.TestProject.TypedDelegateTest); - var metadata = global::TUnit.Core.TestMetadataFactory.Create( - "TestWithDelegate", "TestWithDelegate", 7, - __InvokeTest_TestWithDelegate, __CreateAttributes_0, CreateInstance, - global::TUnit.Core.MethodMetadataFactory.Create("TestWithDelegate", __classType, typeof(void), __classMetadata), - testSessionId: testSessionId - ); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - internal static global::TUnit.TestProject.TypedDelegateTest CreateInstance(global::System.Type[] typeArgs, object?[] args) - { - return new global::TUnit.TestProject.TypedDelegateTest(); - } + MethodMetadata = __mm_0, + CreateInstance = __CreateInstance, + InvokeBody = __Invoke, + MethodIndex = 0, + CreateAttributes = __Attributes, + AttributeGroupIndex = 0, + }, + }; } internal static partial class TUnit_TestRegistration { - static readonly int _r_TUnit_TestProject_TypedDelegateTest__TestSource = global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof(global::TUnit.TestProject.TypedDelegateTest), TUnit_TestProject_TypedDelegateTest__TestSource.GetTests, TUnit_TestProject_TypedDelegateTest__TestSource.EnumerateTestDescriptors); + static readonly int _r_TUnit_TestProject_TypedDelegateTest__TestSource = global::TUnit.Core.SourceRegistrar.RegisterEntries(TUnit_TestProject_TypedDelegateTest__TestSource.Entries); } diff --git a/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs b/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs index bc0c55b22a..31cdf7418f 100644 --- a/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs +++ b/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs @@ -298,8 +298,10 @@ private static void GenerateTestMethodSource(SourceProductionContext context, Te return; } - // Non-generic, non-inherited tests are handled by the per-class TestSource pipeline - if (testMethod is { IsGenericType: false, IsGenericMethod: false, InheritanceDepth: 0 }) + // Non-generic, non-inherited tests are handled by the per-class TestEntry pipeline. + // Inherited tests (InheritanceDepth > 0) come through GenerateInheritedTestSources + // and must be handled here. + if (!testMethod.IsGenericType && !testMethod.IsGenericMethod && testMethod.InheritanceDepth == 0) { return; } @@ -350,163 +352,810 @@ private static void GenerateTestMetadata(CodeWriter writer, TestMethodMetadata t var uniqueClassName = FileNameHelper.GetDeterministicFileNameForMethod(testMethod.TypeSymbol, testMethod.MethodSymbol) .Replace(".g.cs", "_TestSource"); + List concreteInstantiations; + + if (!testMethod.IsGenericType && !testMethod.IsGenericMethod) + { + // Non-generic inherited test — create a single concrete instantiation for the class type + concreteInstantiations = + [ + new ConcreteInstantiation + { + ConcreteClassName = className, + TypeArguments = [], + ClassTypeArgs = [], + MethodTypeArgs = [], + TestName = testMethod.MethodSymbol.Name, + MethodName = testMethod.MethodSymbol.Name, + } + ]; + } + else + { + // Collect all concrete type instantiations for this generic test method + concreteInstantiations = CollectConcreteInstantiations(testMethod, className); + + if (concreteInstantiations.Count == 0) + { + // No concrete types could be resolved — skip this method. + // The test won't be discovered, which matches the behavior of + // not having any data to resolve type arguments. + return; + } + } + + // Group instantiations by concrete class type for TestEntry emission + var groupedByConcreteClass = concreteInstantiations + .GroupBy(ci => ci.ConcreteClassName) + .ToList(); + writer.AppendLine("[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute]"); writer.AppendLine($"[global::System.CodeDom.Compiler.GeneratedCode(\"TUnit\", \"{typeof(TestMetadataGenerator).Assembly.GetName().Version}\")]"); - writer.AppendLine($"internal sealed class {uniqueClassName} : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource"); + writer.AppendLine($"internal static class {uniqueClassName}"); writer.AppendLine("{"); writer.Indent(); - GenerateReflectionFieldAccessors(writer, testMethod.TypeSymbol); + // Shared ClassMetadata + classType as static fields + inlined MethodMetadata + var compilation = testMethod.Context!.Value.SemanticModel.Compilation; + var classMetadataExpr = MetadataGenerationHelper.GenerateClassMetadataGetOrAddWithParentExpression(testMethod.TypeSymbol, writer.IndentLevel); + writer.AppendLine($"private static readonly global::TUnit.Core.ClassMetadata __classMetadata = {classMetadataExpr};"); + writer.AppendLine($"private static readonly global::System.Type __classType = typeof({className});"); + writer.AppendLine($"private static readonly global::TUnit.Core.MethodMetadata __mm_0 = {GenerateMethodMetadataFactoryCall(testMethod.MethodSymbol)};"); - writer.AppendLine("public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId)"); - writer.AppendLine("{"); - writer.Indent(); + // Emit per-group helpers and TestEntry arrays + var registrationIndex = 0; + foreach (var group in groupedByConcreteClass) + { + var concreteClassName = group.Key; + var entries = group.ToList(); + var groupIndex = registrationIndex; + + // CreateInstance for this concrete type + writer.AppendLine($"private static {concreteClassName} __CreateInstance_{groupIndex}(global::System.Type[] typeArgs, object?[] args)"); + writer.AppendLine("{"); + writer.Indent(); + EmitConcreteInstanceCreation(writer, testMethod, concreteClassName, entries[0]); + writer.Unindent(); + writer.AppendLine("}"); - var needsList = testMethod.IsGenericType || testMethod is { IsGenericMethod: true, MethodSymbol.TypeParameters.Length: > 0 }; + // Invoke switch for this concrete type + writer.AppendLine($"private static global::System.Threading.Tasks.ValueTask __Invoke_{groupIndex}({concreteClassName} instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken)"); + writer.AppendLine("{"); + writer.Indent(); + if (entries.Count == 1) + { + EmitConcreteInvokeBody(writer, testMethod, entries[0]); + } + else + { + writer.AppendLine("switch (methodIndex)"); + writer.AppendLine("{"); + writer.Indent(); + for (var i = 0; i < entries.Count; i++) + { + writer.AppendLine($"case {i}:"); + writer.AppendLine("{"); + writer.Indent(); + EmitConcreteInvokeBody(writer, testMethod, entries[i]); + writer.Unindent(); + writer.AppendLine("}"); + } + writer.AppendLine("default:"); + writer.Indent(); + writer.AppendLine("throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex));"); + writer.Unindent(); + writer.Unindent(); + writer.AppendLine("}"); + } + writer.Unindent(); + writer.AppendLine("}"); - if (needsList) + // Attributes switch for this group + writer.AppendLine($"private static global::System.Attribute[] __Attributes_{groupIndex}(int groupIndex)"); + writer.AppendLine("{"); + writer.Indent(); + if (entries.Count == 1) + { + EmitConcreteAttributeFactory(writer, testMethod, entries[0]); + } + else + { + writer.AppendLine("switch (groupIndex)"); + writer.AppendLine("{"); + writer.Indent(); + for (var i = 0; i < entries.Count; i++) + { + writer.AppendLine($"case {i}:"); + writer.AppendLine("{"); + writer.Indent(); + EmitConcreteAttributeFactory(writer, testMethod, entries[i]); + writer.Unindent(); + writer.AppendLine("}"); + } + writer.AppendLine("default:"); + writer.Indent(); + writer.AppendLine("throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex));"); + writer.Unindent(); + writer.Unindent(); + writer.AppendLine("}"); + } + writer.Unindent(); + writer.AppendLine("}"); + + // TestEntry array + writer.AppendLine($"public static readonly global::TUnit.Core.TestEntry<{concreteClassName}>[] Entries_{groupIndex} = new global::TUnit.Core.TestEntry<{concreteClassName}>[]"); + writer.AppendLine("{"); + writer.Indent(); + for (var i = 0; i < entries.Count; i++) + { + var entry = entries[i]; + writer.AppendLine($"new global::TUnit.Core.TestEntry<{concreteClassName}>"); + writer.AppendLine("{"); + writer.Indent(); + EmitTestEntryFields(writer, testMethod, entry, i, groupIndex); + writer.Unindent(); + writer.AppendLine("},"); + } + writer.Unindent(); + writer.AppendLine("};"); + + registrationIndex++; + } + + writer.Unindent(); + writer.AppendLine("}"); + + // Registration calls + registrationIndex = 0; + foreach (var group in groupedByConcreteClass) { - writer.AppendLine("var __results = new global::System.Collections.Generic.List();"); - writer.AppendLine(); + var concreteClassName = group.Key; + EmitRegistrationField(writer, $"{uniqueClassName}_{registrationIndex}", + $"global::TUnit.Core.SourceRegistrar.RegisterEntries({uniqueClassName}.Entries_{registrationIndex})"); + registrationIndex++; + } + } - var hasTypedDataSource = testMethod.MethodAttributes - .Any(a => DataSourceAttributeHelper.IsDataSourceAttribute(a.AttributeClass) && - InferTypesFromDataSourceAttribute(testMethod.MethodSymbol, a) != null); + /// + /// Represents a single concrete instantiation of a generic test. + /// + private sealed class ConcreteInstantiation + { + public required string ConcreteClassName { get; init; } + public required ITypeSymbol[] TypeArguments { get; init; } + public required ITypeSymbol[] ClassTypeArgs { get; init; } + public required ITypeSymbol[] MethodTypeArgs { get; init; } + public required string TestName { get; init; } + public required string MethodName { get; init; } + public AttributeData? SpecificArgumentsAttribute { get; init; } + public bool HasParameterizedConstructor { get; init; } + } - var hasGenerateGenericTest = (testMethod.IsGenericMethod && testMethod.MethodAttributes - .Any(a => a.AttributeClass?.IsOrInherits("global::TUnit.Core.GenerateGenericTestAttribute") is true)) || - (testMethod.IsGenericType && testMethod.TypeSymbol.GetAttributes() - .Any(a => a.AttributeClass?.IsOrInherits("global::TUnit.Core.GenerateGenericTestAttribute") is true)); + /// + /// Collects all concrete type instantiations for this generic test method. + /// + private static List CollectConcreteInstantiations(TestMethodMetadata testMethod, string className) + { + var compilation = testMethod.Context!.Value.SemanticModel.Compilation; + var methodName = testMethod.MethodSymbol.Name; + var results = new List(); + var processedTypeCombinations = new HashSet(); - var hasClassArguments = testMethod.TypeSymbol.GetAttributes() - .Any(a => a.AttributeClass?.IsOrInherits("global::TUnit.Core.ArgumentsAttribute") is true); + var classTypeArgCount = testMethod.IsGenericType ? testMethod.TypeSymbol.TypeParameters.Length : 0; + var methodTypeArgCount = testMethod.IsGenericMethod ? testMethod.MethodSymbol.TypeParameters.Length : 0; - var hasTypedDataSourceForGenericType = testMethod is { IsGenericType: true, IsGenericMethod: false } && testMethod.MethodAttributes - .Any(a => a.AttributeClass != null && - a.AttributeClass.IsOrInherits("global::TUnit.Core.AsyncDataSourceGeneratorAttribute") && - InferTypesFromTypedDataSourceForClass(testMethod.TypeSymbol, testMethod.MethodSymbol) != null); + void TryAddInstantiation(ITypeSymbol[] typeArguments, AttributeData? specificAttr = null) + { + var typeKey = BuildTypeKey(typeArguments); + if (!processedTypeCombinations.Add(typeKey)) + { + return; + } - var hasMethodArgumentsForGenericType = testMethod is { IsGenericType: true, IsGenericMethod: false } && testMethod.MethodAttributes - .Any(a => a.AttributeClass?.IsOrInherits("global::TUnit.Core.ArgumentsAttribute") is true); + var classTypeArgs = classTypeArgCount > 0 ? typeArguments.Take(classTypeArgCount).ToArray() : Array.Empty(); + var methodTypeArgs = methodTypeArgCount > 0 ? typeArguments.Skip(classTypeArgCount).ToArray() : Array.Empty(); - var hasMethodDataSourceForGenericType = testMethod is { IsGenericType: true, IsGenericMethod: false } && testMethod.MethodAttributes - .Any(a => a.AttributeClass?.Name == "MethodDataSourceAttribute" && - InferClassTypesFromMethodDataSource(testMethod, a) != null); + // Validate constraints + if (classTypeArgs.Length > 0 && !ValidateClassTypeConstraints(testMethod.TypeSymbol, classTypeArgs)) + { + return; + } + if (methodTypeArgs.Length > 0 && !ValidateTypeConstraints(testMethod.MethodSymbol, methodTypeArgs)) + { + return; + } - // Check for class-level data sources that could help resolve generic type arguments - var hasClassDataSources = testMethod.IsGenericType && testMethod.TypeSymbol.GetAttributesIncludingBaseTypes() - .Any(a => DataSourceAttributeHelper.IsDataSourceAttribute(a.AttributeClass)); + // Build concrete class name + string concreteClassName; + if (testMethod.IsGenericType && classTypeArgs.Length > 0) + { + var baseClassName = className.Contains("<") ? className.Substring(0, className.IndexOf('<')) : className; + concreteClassName = $"{baseClassName}<{string.Join(", ", classTypeArgs.Select(t => t.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)))}>"; + } + else + { + concreteClassName = className; + } - if (hasTypedDataSource || hasGenerateGenericTest || testMethod.IsGenericMethod || hasClassArguments || hasTypedDataSourceForGenericType || hasMethodArgumentsForGenericType || hasMethodDataSourceForGenericType || hasClassDataSources) + // Build test name + string testName; + if (methodTypeArgs.Length > 0) { - GenerateGenericTestWithConcreteTypes(writer, testMethod, className); + testName = $"{methodName}<{string.Join(", ", methodTypeArgs.Select(t => t.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)))}>"; } else { - // For generic classes with no way to resolve type arguments, this will generate - // GenericTestMetadata that the engine will fail with a clear error message - GenerateTestMetadataInstance(writer, testMethod, className); + testName = methodName; } - writer.AppendLine("return __results;"); + // Check for parameterized constructor + var hasParameterizedConstructor = false; + if (testMethod.IsGenericType) + { + var constructor = testMethod.TypeSymbol.Constructors + .Where(c => !c.IsStatic && c.DeclaredAccessibility == Accessibility.Public) + .OrderByDescending(c => c.Parameters.Length) + .FirstOrDefault(); + if (constructor is { Parameters.Length: > 0 }) + { + hasParameterizedConstructor = true; + } + } + + results.Add(new ConcreteInstantiation + { + ConcreteClassName = concreteClassName, + TypeArguments = typeArguments, + ClassTypeArgs = classTypeArgs, + MethodTypeArgs = methodTypeArgs, + TestName = testName, + MethodName = methodName, + SpecificArgumentsAttribute = specificAttr, + HasParameterizedConstructor = hasParameterizedConstructor, + }); + } + + var methodArgumentsAttributes = testMethod.MethodAttributes + .Where(a => a.AttributeClass?.Name == "ArgumentsAttribute") + .ToArray(); + + var classArgumentsAttributes = testMethod.IsGenericType + ? testMethod.TypeSymbol.GetAttributes() + .Where(a => a.AttributeClass?.Name == "ArgumentsAttribute") + .ToArray() + : Array.Empty(); + + // Handle class+method Arguments combinations + if (testMethod is { IsGenericType: true, IsGenericMethod: true } && classArgumentsAttributes.Any() && methodArgumentsAttributes.Any()) + { + foreach (var classAttr in classArgumentsAttributes) + { + var classTypes = InferTypesFromClassArgumentsAttribute(testMethod.TypeSymbol, classAttr, compilation); + if (classTypes == null || classTypes.Length == 0) continue; + + foreach (var methodAttr in methodArgumentsAttributes) + { + var methodTypes = InferTypesFromArgumentsAttribute(testMethod.MethodSymbol, methodAttr, compilation); + if (methodTypes == null || methodTypes.Length == 0) continue; + + var combinedTypes = new ITypeSymbol[classTypes.Length + methodTypes.Length]; + Array.Copy(classTypes, 0, combinedTypes, 0, classTypes.Length); + Array.Copy(methodTypes, 0, combinedTypes, classTypes.Length, methodTypes.Length); + TryAddInstantiation(combinedTypes, classAttr); + } + } } else { - GenerateTestMetadataInstance(writer, testMethod, className, addToResultsList: false, useNamedMethods: true); - writer.AppendLine("return new global::TUnit.Core.TestMetadata[] { metadata };"); + // Handle class-only or method-only Arguments attributes + var allArgumentsAttributes = new List(); + if (!(testMethod is { IsGenericType: true, IsGenericMethod: false })) + { + allArgumentsAttributes.AddRange(methodArgumentsAttributes); + } + allArgumentsAttributes.AddRange(classArgumentsAttributes); + + foreach (var argAttr in allArgumentsAttributes) + { + ITypeSymbol[]? inferredTypes; + if (testMethod.IsGenericType && classArgumentsAttributes.Contains(argAttr)) + { + inferredTypes = InferTypesFromClassArgumentsAttribute(testMethod.TypeSymbol, argAttr, compilation); + } + else + { + inferredTypes = InferTypesFromArgumentsAttribute(testMethod.MethodSymbol, argAttr, compilation); + } + if (inferredTypes is { Length: > 0 }) + { + TryAddInstantiation(inferredTypes, argAttr); + } + } } - writer.Unindent(); - writer.AppendLine("}"); - writer.AppendLine(); + // Handle generic classes with non-generic methods that have method-level Arguments + if (testMethod is { IsGenericType: true, IsGenericMethod: false } && methodArgumentsAttributes.Length > 0) + { + foreach (var methodArgAttr in methodArgumentsAttributes) + { + var inferredTypes = InferClassTypesFromMethodArguments(testMethod.TypeSymbol, testMethod.MethodSymbol, methodArgAttr, compilation); + if (inferredTypes is { Length: > 0 }) + { + TryAddInstantiation(inferredTypes, methodArgAttr); + } + } + } - // Generate EnumerateTestDescriptors method for fast filtering - GenerateEnumerateTestDescriptors(writer, testMethod); + // Process typed data source attributes + foreach (var dataSourceAttr in testMethod.MethodAttributes.Where(a => DataSourceAttributeHelper.IsDataSourceAttribute(a.AttributeClass))) + { + var inferredTypes = InferTypesFromDataSourceAttribute(testMethod.MethodSymbol, dataSourceAttr); + if (inferredTypes is { Length: > 0 }) + { + TryAddInstantiation(inferredTypes, dataSourceAttr); + } + } - // Non-generic, direct test methods use the per-class helper for instance creation - // and module initialization. Generic or inherited tests keep the per-method pattern. - var useClassHelper = !needsList && testMethod.InheritanceDepth == 0; + // Process IInfersType attributes on parameters + if (testMethod.IsGenericMethod) + { + var inferredTypes = InferTypesFromTypeInferringAttributes(testMethod.MethodSymbol); + if (inferredTypes is { Length: > 0 }) + { + TryAddInstantiation(inferredTypes); + } + } - if (!needsList) + // Process MethodDataSource attributes for generic classes (non-generic methods) + if (testMethod is { IsGenericType: true, IsGenericMethod: false }) { - // 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); - if (!useClassHelper) + foreach (var mdsAttr in testMethod.MethodAttributes.Where(a => a.AttributeClass?.Name == "MethodDataSourceAttribute")) { - writer.AppendLine(); - EmitInstanceFactoryMethod(writer, testMethod); + var inferredTypes = InferClassTypesFromMethodDataSource(testMethod, mdsAttr); + if (inferredTypes is { Length: > 0 }) + { + TryAddInstantiation(inferredTypes); + } } - if (testMethod is { IsGenericType: false, IsGenericMethod: false }) + + // Process typed data source attributes for generic classes + var typedDataSourceInferredTypes = InferTypesFromTypedDataSourceForClass(testMethod.TypeSymbol, testMethod.MethodSymbol); + if (typedDataSourceInferredTypes is { Length: > 0 }) { - writer.AppendLine(); - EmitInvokeTestMethod(writer, testMethod, className); + TryAddInstantiation(typedDataSourceInferredTypes); } } - writer.Unindent(); - writer.AppendLine("}"); + // Process MethodDataSource attributes for generic methods + if (testMethod.IsGenericMethod) + { + foreach (var mdsAttr in testMethod.MethodAttributes.Where(a => a.AttributeClass?.Name == "MethodDataSourceAttribute")) + { + var inferredTypes = InferTypesFromMethodDataSource(testMethod, mdsAttr); + if (inferredTypes is { Length: > 0 }) + { + TryAddInstantiation(inferredTypes, mdsAttr); + } + } + } - if (!useClassHelper) + // Process class-level Arguments attributes for generic classes + if (testMethod.IsGenericType) { - GenerateTestRegistrationField(writer, testMethod, uniqueClassName); + foreach (var argAttr in testMethod.TypeSymbol.GetAttributes().Where(a => a.AttributeClass?.Name == "ArgumentsAttribute")) + { + var classInferredTypes = InferTypesFromClassArgumentsAttribute(testMethod.TypeSymbol, argAttr, compilation); + if (classInferredTypes is { Length: > 0 }) + { + if (testMethod.IsGenericMethod) + { + foreach (var methodArgAttr in testMethod.MethodAttributes.Where(a => a.AttributeClass?.Name == "ArgumentsAttribute")) + { + var methodInferredTypes = InferTypesFromArgumentsAttribute(testMethod.MethodSymbol, methodArgAttr, compilation); + if (methodInferredTypes is { Length: > 0 }) + { + TryAddInstantiation(classInferredTypes.Concat(methodInferredTypes).ToArray(), argAttr); + } + } + } + else + { + TryAddInstantiation(classInferredTypes, argAttr); + } + } + } } + + // Process GenerateGenericTest attributes + // GenerateGenericTestAttribute takes params Type[] in its constructor, so extract from constructor args + { + var methodGenericTestAttrs = testMethod.IsGenericMethod + ? testMethod.MethodAttributes + .Where(a => a.AttributeClass?.IsOrInherits("global::TUnit.Core.GenerateGenericTestAttribute") is true) + .Select(ExtractTypeArgsFromGenerateGenericTestAttribute) + .Where(t => t is { Length: > 0 }) + .ToList() + : new List(); + + var classGenericTestAttrs = testMethod.IsGenericType + ? testMethod.TypeSymbol.GetAttributes() + .Where(a => a.AttributeClass?.IsOrInherits("global::TUnit.Core.GenerateGenericTestAttribute") is true) + .Select(ExtractTypeArgsFromGenerateGenericTestAttribute) + .Where(t => t is { Length: > 0 }) + .ToList() + : new List(); + + if (testMethod is { IsGenericType: true, IsGenericMethod: true } && classGenericTestAttrs.Count > 0 && methodGenericTestAttrs.Count > 0) + { + // Cartesian product of class and method type args + foreach (var classTypeArgs in classGenericTestAttrs) + { + foreach (var methodTypeArgs in methodGenericTestAttrs) + { + if (classTypeArgs != null && methodTypeArgs != null) + { + var combined = classTypeArgs.Concat(methodTypeArgs).ToArray(); + TryAddInstantiation(combined); + } + } + } + } + else + { + // Only class or only method + foreach (var typeArgs in classGenericTestAttrs) + { + if (typeArgs != null) + { + TryAddInstantiation(typeArgs); + } + } + foreach (var typeArgs in methodGenericTestAttrs) + { + if (typeArgs != null) + { + TryAddInstantiation(typeArgs); + } + } + } + } + + return results; } - private static void GenerateTestMetadataInstance(CodeWriter writer, TestMethodMetadata testMethod, string className, bool addToResultsList = true, bool useNamedMethods = false) + /// + /// Extracts type arguments from a GenerateGenericTestAttribute's constructor arguments. + /// The attribute takes params Type[] in its constructor. + /// + private static ITypeSymbol[]? ExtractTypeArgsFromGenerateGenericTestAttribute(AttributeData attr) { - var methodName = testMethod.MethodSymbol.Name; + if (attr.ConstructorArguments.Length == 0) + { + return null; + } + + var firstArg = attr.ConstructorArguments[0]; - // For generic types or methods, use GenericTestMetadata; for concrete types, use TestMetadata - if (testMethod.IsGenericType || testMethod.IsGenericMethod) + // params Type[] can appear as a single array argument or as individual arguments + if (firstArg.Kind == TypedConstantKind.Array) { - writer.AppendLine("var metadata = new global::TUnit.Core.GenericTestMetadata"); + return firstArg.Values + .Where(v => v.Value is INamedTypeSymbol) + .Select(v => (ITypeSymbol)(INamedTypeSymbol)v.Value!) + .ToArray(); + } + + // Single Type argument (params expansion) + if (firstArg.Value is INamedTypeSymbol singleType) + { + return [singleType]; + } + + return null; + } + + /// + /// Emits instance creation code for a concrete type. + /// + private static void EmitConcreteInstanceCreation(CodeWriter writer, TestMethodMetadata testMethod, string concreteClassName, ConcreteInstantiation entry) + { + if (InstanceFactoryGenerator.HasClassConstructorAttribute(testMethod.TypeSymbol)) + { + writer.AppendLine("throw new global::System.NotSupportedException(\"Instance creation for classes with ClassConstructor attribute is handled at runtime\");"); + } + else if (entry.HasParameterizedConstructor && entry.SpecificArgumentsAttribute is { ConstructorArguments.Length: > 0 } specificAttr && + specificAttr.ConstructorArguments[0].Kind == TypedConstantKind.Array) + { + var argumentValues = specificAttr.ConstructorArguments[0].Values; + var constructorArgs = string.Join(", ", argumentValues.Select(arg => TypedConstantParser.GetRawTypedConstantValue(arg))); + writer.AppendLine($"return ({concreteClassName})global::System.Activator.CreateInstance(typeof({concreteClassName}), new object[] {{ {constructorArgs} }})!;"); + } + else if (entry.HasParameterizedConstructor) + { + writer.AppendLine($"return ({concreteClassName})global::System.Activator.CreateInstance(typeof({concreteClassName}), args)!;"); + } + else if (!testMethod.IsGenericType && !testMethod.IsGenericMethod) + { + // Non-generic (inherited) tests: use InstanceFactoryGenerator for proper required property handling + writer.AppendRaw(InstanceFactoryGenerator.GenerateInstanceFactoryBody(testMethod.TypeSymbol)); + } + else if (entry.ClassTypeArgs.Length > 0) + { + // Generic class with resolved type args: construct the concrete closed type + var constructedType = testMethod.TypeSymbol.Construct(entry.ClassTypeArgs); + writer.AppendRaw(InstanceFactoryGenerator.GenerateInstanceFactoryBody(constructedType)); } else { - writer.AppendLine($"var metadata = new global::TUnit.Core.TestMetadata<{className}>"); + writer.AppendLine($"return new {concreteClassName}();"); } + } - writer.AppendLine("{"); - writer.Indent(); + /// + /// Emits the invoke body for a concrete type instantiation. + /// + private static void EmitConcreteInvokeBody(CodeWriter writer, TestMethodMetadata testMethod, ConcreteInstantiation entry) + { + var methodName = entry.MethodName; + var hasCancellationToken = testMethod.MethodSymbol.Parameters.Any(p => + p.Type.Name == "CancellationToken" && p.Type.ContainingNamespace?.ToString() == "System.Threading"); + var returnPattern = GetReturnPattern(testMethod.MethodSymbol); - writer.AppendLine($"TestName = \"{methodName}\","); - writer.AppendLine($"TestClassType = {GenerateTypeReference(testMethod.TypeSymbol, testMethod.IsGenericType)},"); - writer.AppendLine($"TestMethodName = \"{methodName}\","); + // For any generic context (class or method), we need to substitute type parameters + if (entry.MethodTypeArgs.Length > 0 || entry.ClassTypeArgs.Length > 0) + { + // Build the method call with proper type substitution + var parameterCasts = new List(); + for (var i = 0; i < testMethod.MethodSymbol.Parameters.Length; i++) + { + var param = testMethod.MethodSymbol.Parameters[i]; + if (param.Type.Name == "CancellationToken" && param.Type.ContainingNamespace?.ToString() == "System.Threading") + { + parameterCasts.Add("cancellationToken"); + } + else + { + var paramType = SubstituteTypeParameters(param.Type, testMethod, entry.ClassTypeArgs, entry.MethodTypeArgs); + parameterCasts.Add($"global::TUnit.Core.Helpers.CastHelper.Cast<{paramType.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)}>(args[{i}])"); + } + } - GenerateMetadata(writer, testMethod, useNamedMethods); + string methodCall; + if (entry.MethodTypeArgs.Length > 0) + { + var methodTypeArgsString = string.Join(", ", entry.MethodTypeArgs.Select(t => t.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat))); + methodCall = $"instance.{methodName}<{methodTypeArgsString}>({string.Join(", ", parameterCasts)})"; + } + else + { + methodCall = $"instance.{methodName}({string.Join(", ", parameterCasts)})"; + } - if (testMethod.IsGenericType) + // Wrap in try-catch + writer.AppendLine("try"); + writer.AppendLine("{"); + writer.Indent(); + + switch (returnPattern) + { + case TestReturnPattern.Void: + writer.AppendLine($"{methodCall};"); + writer.AppendLine("return default(global::System.Threading.Tasks.ValueTask);"); + break; + case TestReturnPattern.ValueTask: + writer.AppendLine($"return {methodCall};"); + break; + case TestReturnPattern.Task: + writer.AppendLine($"return new global::System.Threading.Tasks.ValueTask({methodCall});"); + break; + default: + writer.AppendLine($"return global::TUnit.Core.AsyncConvert.Convert(() => {methodCall});"); + break; + } + + writer.Unindent(); + writer.AppendLine("}"); + writer.AppendLine("catch (global::System.Exception ex)"); + writer.AppendLine("{"); + writer.Indent(); + writer.AppendLine("return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex));"); + writer.Unindent(); + writer.AppendLine("}"); + } + else { - GenerateGenericTypeInfo(writer, testMethod.TypeSymbol); + // Non-generic — use standard invoke (shouldn't normally reach here for generic path) + var parametersFromArgs = testMethod.MethodSymbol.Parameters + .Where(p => p.Type.Name != "CancellationToken" || p.Type.ContainingNamespace?.ToString() != "System.Threading") + .ToArray(); + GenerateConcreteTestInvokerBody(writer, methodName, returnPattern, hasCancellationToken, parametersFromArgs); } + } - // Generate generic method info if needed - if (testMethod.IsGenericMethod) + /// + /// Emits attribute factory code for a concrete instantiation. + /// + private static void EmitConcreteAttributeFactory(CodeWriter writer, TestMethodMetadata testMethod, ConcreteInstantiation entry) + { + // Build filtered attributes + var filteredAttributes = new List(); + + foreach (var attr in testMethod.MethodSymbol.GetAttributes()) { - GenerateGenericMethodInfo(writer, testMethod.MethodSymbol); + if (attr.AttributeClass?.Name == "ArgumentsAttribute" && entry.SpecificArgumentsAttribute != null) + { + if (AreSameAttribute(attr, entry.SpecificArgumentsAttribute)) + { + filteredAttributes.Add(attr); + } + } + else + { + filteredAttributes.Add(attr); + } } - // Generate typed invokers and factory - GenerateTypedInvokers(writer, testMethod, className, useNamedMethods); + filteredAttributes.AddRange(testMethod.TypeSymbol.GetAttributesIncludingBaseTypes()); + filteredAttributes.AddRange(testMethod.TypeSymbol.ContainingAssembly.GetAttributes()); + writer.AppendLine("return new global::System.Attribute[]"); + writer.AppendLine("{"); + writer.Indent(); + testMethod.CompilationContext.AttributeWriter.WriteAttributes(writer, filteredAttributes); writer.Unindent(); writer.AppendLine("};"); + } + + /// + /// Emits the TestEntry field values for a concrete instantiation. + /// + private static void EmitTestEntryFields(CodeWriter writer, TestMethodMetadata testMethod, ConcreteInstantiation entry, int entryIndex, int groupIndex) + { + var methodName = entry.TestName; + var namespaceName = testMethod.TypeSymbol.ContainingNamespace?.ToDisplayString() ?? ""; + var simpleClassName = testMethod.TypeSymbol.GetNestedClassName(); + + // For generic classes, include type arguments in the class name + string displayClassName; + if (entry.ClassTypeArgs.Length > 0) + { + var typeArgsStr = string.Join(",", entry.ClassTypeArgs.Select(t => t.ToDisplayString(SymbolDisplayFormat.MinimallyQualifiedFormat))); + displayClassName = $"{simpleClassName}<{typeArgsStr}>"; + } + else + { + displayClassName = simpleClassName; + } + + var fullyQualifiedName = string.IsNullOrEmpty(namespaceName) + ? $"{displayClassName}.{methodName}" + : $"{namespaceName}.{displayClassName}.{methodName}"; + + var categories = ExtractCategories(testMethod); + var categoriesArray = categories.Count == 0 + ? "global::System.Array.Empty()" + : $"new string[] {{ {string.Join(", ", categories.Select(c => $"\"{EscapeString(c)}\""))} }}"; + + var properties = ExtractProperties(testMethod); + var propertiesArray = properties.Length == 0 + ? "global::System.Array.Empty()" + : $"new string[] {{ {string.Join(", ", properties.Select(p => $"\"{EscapeString(p)}\""))} }}"; + + var hasDataSource = HasDataSources(testMethod); + var repeatCount = ExtractRepeatCount(testMethod); + + var dependsOn = ExtractDependsOn(testMethod); + var dependsOnArray = dependsOn.Length == 0 + ? "global::System.Array.Empty()" + : $"new string[] {{ {string.Join(", ", dependsOn.Select(d => $"\"{EscapeString(d)}\""))} }}"; + + writer.AppendLine($"MethodName = \"{EscapeString(entry.TestName)}\","); + writer.AppendLine($"FullyQualifiedName = \"{EscapeString(fullyQualifiedName)}\","); + writer.AppendLine($"FilePath = @\"{(testMethod.FilePath ?? "").Replace("\\", "\\\\")}\","); + writer.AppendLine($"LineNumber = {testMethod.LineNumber},"); + writer.AppendLine($"Categories = {categoriesArray},"); + writer.AppendLine($"Properties = {propertiesArray},"); + writer.AppendLine($"HasDataSource = {(hasDataSource ? "true" : "false")},"); + writer.AppendLine($"RepeatCount = {repeatCount},"); + writer.AppendLine($"DependsOn = {dependsOnArray},"); + writer.AppendLine($"MethodMetadata = __mm_0,"); + writer.AppendLine($"CreateInstance = __CreateInstance_{groupIndex},"); + writer.AppendLine($"InvokeBody = __Invoke_{groupIndex},"); + writer.AppendLine($"MethodIndex = {entryIndex},"); + writer.AppendLine($"CreateAttributes = __Attributes_{groupIndex},"); + writer.AppendLine($"AttributeGroupIndex = {entryIndex},"); + + // Data sources + EmitConcreteDataSources(writer, testMethod, entry); + + // Dependencies + var depsExpr = PreGenerateDependenciesExpression(testMethod.MethodSymbol); + if (depsExpr != null) + { + writer.AppendLine($"Dependencies = {depsExpr},"); + } + } + + /// + /// Emits data source fields for a concrete test entry. + /// + private static void EmitConcreteDataSources(CodeWriter writer, TestMethodMetadata testMethod, ConcreteInstantiation entry) + { + var methodSymbol = testMethod.MethodSymbol; + var typeSymbol = testMethod.TypeSymbol; + + // Construct concrete type for data source generation + INamedTypeSymbol concreteTypeSymbol = typeSymbol; + if (testMethod.IsGenericType && entry.ClassTypeArgs.Length > 0) + { + var classTypeArgCount = typeSymbol.TypeParameters.Length; + if (classTypeArgCount > 0 && entry.TypeArguments.Length >= classTypeArgCount) + { + concreteTypeSymbol = typeSymbol.Construct(entry.ClassTypeArgs); + } + } + + // Method data sources + List methodDataSources; + AttributeData[] classDataSources; + + if (entry.SpecificArgumentsAttribute != null) + { + methodDataSources = methodSymbol.GetAttributes() + .Where(a => AreSameAttribute(a, entry.SpecificArgumentsAttribute)) + .ToList(); + + if (testMethod is { IsGenericType: true, IsGenericMethod: true }) + { + var additionalMethodDataSources = methodSymbol.GetAttributes() + .Where(a => a.AttributeClass?.Name == "ArgumentsAttribute" && + !AreSameAttribute(a, entry.SpecificArgumentsAttribute)); + methodDataSources.AddRange(additionalMethodDataSources); + } + + classDataSources = typeSymbol.GetAttributesIncludingBaseTypes() + .Where(a => AreSameAttribute(a, entry.SpecificArgumentsAttribute)) + .ToArray(); + } + else + { + methodDataSources = methodSymbol.GetAttributes() + .Where(a => DataSourceAttributeHelper.IsDataSourceAttribute(a.AttributeClass)) + .ToList(); - if (testMethod is { IsGenericType: false, IsGenericMethod: false }) - { - writer.AppendLine("metadata.UseRuntimeDataGeneration(testSessionId);"); + classDataSources = typeSymbol.GetAttributesIncludingBaseTypes() + .Where(a => DataSourceAttributeHelper.IsDataSourceAttribute(a.AttributeClass)) + .ToArray(); } - else + + if (methodDataSources.Count > 0) { - // For generic types/methods, set TestSessionId directly - writer.AppendLine("metadata.TestSessionId = testSessionId;"); + var dsWriter = new CodeWriter(includeHeader: false); + dsWriter.AppendLine("new global::TUnit.Core.IDataSourceAttribute[]"); + dsWriter.AppendLine("{"); + dsWriter.Indent(); + foreach (var attr in methodDataSources) + { + GenerateDataSourceAttribute(dsWriter, testMethod.CompilationContext, attr, methodSymbol, concreteTypeSymbol); + } + dsWriter.Unindent(); + dsWriter.Append("}"); + writer.AppendLine($"TestDataSources = {dsWriter},"); } - if (addToResultsList) + if (classDataSources.Length > 0) { - writer.AppendLine("__results.Add(metadata);"); + var dsWriter = new CodeWriter(includeHeader: false); + dsWriter.AppendLine("new global::TUnit.Core.IDataSourceAttribute[]"); + dsWriter.AppendLine("{"); + dsWriter.Indent(); + foreach (var attr in classDataSources) + { + GenerateDataSourceAttribute(dsWriter, testMethod.CompilationContext, attr, methodSymbol, concreteTypeSymbol); + } + dsWriter.Unindent(); + dsWriter.Append("}"); + writer.AppendLine($"ClassDataSources = {dsWriter},"); } } @@ -2025,33 +2674,14 @@ private static IEnumerable GetTestAttributes(TestMethodMetadata t } /// - /// 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(); - - testMethod.CompilationContext.AttributeWriter.WriteAttributes(writer, GetTestAttributes(testMethod)); - - writer.Unindent(); - writer.AppendLine("];"); - - writer.Unindent(); - writer.AppendLine("}"); - } - - /// - /// Emits the InstanceFactory as a named static method to avoid generating a display class. + /// Returns ALL attributes including data source attributes. + /// Used by the per-class path where the engine extracts data sources from the attribute array. /// - private static void EmitInstanceFactoryMethod(CodeWriter writer, TestMethodMetadata testMethod) + private static IEnumerable GetAllAttributes(TestMethodMetadata testMethod) { - InstanceFactoryGenerator.GenerateInstanceFactoryAsMethod(writer, testMethod.TypeSymbol); + return testMethod.MethodSymbol.GetAttributes() + .Concat(testMethod.TypeSymbol.GetAttributesIncludingBaseTypes()) + .Concat(testMethod.TypeSymbol.ContainingAssembly.GetAttributes()); } private static (bool HasCancellationToken, IParameterSymbol[] ParametersFromArgs) ParseInvokerParameters(IMethodSymbol methodSymbol) @@ -2068,83 +2698,6 @@ private static (bool HasCancellationToken, IParameterSymbol[] ParametersFromArgs 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, testMethod.MethodSymbol.Name, returnPattern, hasCancellationToken, parametersFromArgs); - writer.Unindent(); - writer.AppendLine("}"); - } - - private static void GenerateEnumerateTestDescriptors(CodeWriter writer, TestMethodMetadata testMethod) - { - var methodName = testMethod.MethodSymbol.Name; - var namespaceName = testMethod.TypeSymbol.ContainingNamespace?.ToDisplayString() ?? ""; - var simpleClassName = testMethod.TypeSymbol.GetNestedClassName(); - var fullyQualifiedName = string.IsNullOrEmpty(namespaceName) - ? $"{simpleClassName}.{methodName}" - : $"{namespaceName}.{simpleClassName}.{methodName}"; - - // Extract categories from CategoryAttribute at compile time - var categories = ExtractCategories(testMethod); - var categoriesArray = categories.Count == 0 - ? "global::System.Array.Empty()" - : $"new string[] {{ {string.Join(", ", categories.Select(c => $"\"{EscapeString(c)}\""))} }}"; - - // Extract properties from PropertyAttribute at compile time - var properties = ExtractProperties(testMethod); - var propertiesArray = properties.Length == 0 - ? "global::System.Array.Empty()" - : $"new string[] {{ {string.Join(", ", properties.Select(p => $"\"{EscapeString(p)}\""))} }}"; - - // Check if test has data sources - var hasDataSource = HasDataSources(testMethod); - - // Extract repeat count from RepeatAttribute - var repeatCount = ExtractRepeatCount(testMethod); - - // Extract dependencies from DependsOnAttribute - var dependsOn = ExtractDependsOn(testMethod); - var dependsOnArray = dependsOn.Length == 0 - ? "global::System.Array.Empty()" - : $"new string[] {{ {string.Join(", ", dependsOn.Select(d => $"\"{EscapeString(d)}\""))} }}"; - - writer.AppendLine("public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors()"); - writer.AppendLine("{"); - writer.Indent(); - - writer.AppendLine("yield return new global::TUnit.Core.TestDescriptor"); - writer.AppendLine("{"); - writer.Indent(); - - writer.AppendLine($"TestId = \"{EscapeString(fullyQualifiedName)}\","); - writer.AppendLine($"ClassName = \"{EscapeString(simpleClassName)}\","); - writer.AppendLine($"MethodName = \"{EscapeString(methodName)}\","); - writer.AppendLine($"FullyQualifiedName = \"{EscapeString(fullyQualifiedName)}\","); - writer.AppendLine($"FilePath = @\"{(testMethod.FilePath ?? "").Replace("\\", "\\\\")}\","); - writer.AppendLine($"LineNumber = {testMethod.LineNumber},"); - writer.AppendLine($"Categories = {categoriesArray},"); - writer.AppendLine($"Properties = {propertiesArray},"); - writer.AppendLine($"HasDataSource = {(hasDataSource ? "true" : "false")},"); - writer.AppendLine($"RepeatCount = {repeatCount},"); - writer.AppendLine($"DependsOn = {dependsOnArray},"); - writer.AppendLine("Materializer = GetTests"); - - writer.Unindent(); - writer.AppendLine("};"); - - writer.Unindent(); - writer.AppendLine("}"); - } - private static HashSet ExtractCategories(TestMethodMetadata testMethod) { var categories = new HashSet(); @@ -2404,12 +2957,6 @@ private static string EscapeString(string value) .Replace("\t", "\\t"); } - private static void GenerateTestRegistrationField(CodeWriter writer, TestMethodMetadata testMethod, string uniqueClassName) - { - EmitRegistrationField(writer, uniqueClassName, - $"global::TUnit.Core.SourceRegistrar.RegisterReturn({GenerateTypeReference(testMethod.TypeSymbol, testMethod.IsGenericType)}, new {uniqueClassName}())"); - } - /// /// Emits a static field on the shared TUnit_TestRegistration partial class. /// All contributions merge into a single .cctor, reducing JIT overhead from O(N) methods to O(1). @@ -2425,58 +2972,73 @@ private static void EmitRegistrationField(CodeWriter writer, string fieldName, s writer.AppendLine("}"); } - // ===================================================================== - // Per-class TestSource: Pre-generation methods - // These are called during the transform step where ISymbol is available. - // They produce pre-generated C# code as strings for storage in ClassTestGroup. - // ===================================================================== + /// + /// Pre-generates the attribute factory body for a test method. + /// Returns the body (return [...];) without the method signature. + /// + private static string PreGenerateAttributeFactoryBody(TestMethodMetadata testMethod) + { + var writer = new CodeWriter(includeHeader: false); + + // Include ALL attributes (including data source attributes like [Arguments], [MethodDataSource]). + // The engine extracts IDataSourceAttribute from the attribute array at materialization time. + writer.AppendLine("return"); + writer.AppendLine("["); + writer.Indent(); + testMethod.CompilationContext.AttributeWriter.WriteAttributes(writer, GetAllAttributes(testMethod)); + writer.Unindent(); + writer.AppendLine("];"); + + return writer.ToString(); + } /// - /// Pre-generates the metadata block for one method's contribution to GetTests(). - /// Uses TestMetadataFactory.Create and MethodMetadataFactory.Create to reduce JIT native code. - /// References shared locals (__classMetadata, __classType) declared at top of GetTests(). + /// Pre-generates the InvokeBody static lambda body for a test method. + /// Output: the try/catch wrapper around instance.MethodName(). + /// Used inside a static lambda: static (instance, args, ct) => { ... } /// - private static string PreGenerateMetadataBlock( - TestMethodMetadata testMethod, - string className, - string methodId, - int attributeGroupIndex) + private static string PreGenerateInvokeSwitchCase(TestMethodMetadata testMethod, int methodIndex) { var writer = new CodeWriter(includeHeader: false); - var methodName = testMethod.MethodSymbol.Name; - var filePath = (testMethod.FilePath ?? "").Replace("\\", "\\\\"); - // Build MethodMetadata factory call - var methodMetadataCall = GenerateMethodMetadataFactoryCall(testMethod.MethodSymbol); + var (hasCancellationToken, parametersFromArgs) = ParseInvokerParameters(testMethod.MethodSymbol); + var returnPattern = GetReturnPattern(testMethod.MethodSymbol); - // Start TestMetadataFactory.Create call - writer.AppendLine($"var metadata_{methodId} = global::TUnit.Core.TestMetadataFactory.Create<{className}>("); + writer.AppendLine($"case {methodIndex}:"); + writer.AppendLine("{"); writer.Indent(); - writer.AppendLine($"\"{methodName}\", \"{methodName}\", {testMethod.LineNumber},"); - writer.AppendLine($"__InvokeTest_{methodId}, __CreateAttributes_{attributeGroupIndex}, CreateInstance,"); - writer.Append(methodMetadataCall); + GenerateConcreteTestInvokerBody(writer, testMethod.MethodSymbol.Name, returnPattern, hasCancellationToken, parametersFromArgs); + writer.Unindent(); + writer.AppendLine("}"); - // Add optional named parameters only when non-default - AppendOptionalFactoryParameters(writer, testMethod, className); + return writer.ToString(); + } - writer.AppendLine(","); - if (!string.IsNullOrEmpty(filePath)) - { - writer.AppendLine($"filePath: @\"{filePath}\","); - } - writer.Append("testSessionId: testSessionId"); + /// + /// Pre-generates the CreateAttributes static lambda body for a test method. + /// Returns ALL attributes including data source attributes. + /// Output: return [new TestAttribute(), new ArgumentsAttribute(1), ...]; + /// + private static string PreGenerateCreateAttributesCode(TestMethodMetadata testMethod) + { + var writer = new CodeWriter(includeHeader: false); + // Non-data-source attributes only — data sources are emitted separately on TestEntry + writer.AppendLine("return"); + writer.AppendLine("["); + writer.Indent(); + testMethod.CompilationContext.AttributeWriter.WriteAttributes(writer, GetTestAttributes(testMethod)); writer.Unindent(); - writer.AppendLine(");"); + writer.AppendLine("];"); return writer.ToString(); } /// - /// Pre-generates the descriptor block for one method's contribution to EnumerateTestDescriptors(). - /// Output: yield return new TestDescriptor { ..., Materializer = __Materialize_{id} }; + /// Pre-generates the pure data fields for a TestEntry initializer. + /// These are the filter-relevant fields: MethodName, FullyQualifiedName, FilePath, etc. /// - private static string PreGenerateDescriptorBlock(TestMethodMetadata testMethod, string methodId) + private static string PreGenerateTestEntryDataFields(TestMethodMetadata testMethod) { var writer = new CodeWriter(includeHeader: false); @@ -2505,11 +3067,6 @@ private static string PreGenerateDescriptorBlock(TestMethodMetadata testMethod, ? "global::System.Array.Empty()" : $"new string[] {{ {string.Join(", ", dependsOn.Select(d => $"\"{EscapeString(d)}\""))} }}"; - writer.AppendLine("yield return new global::TUnit.Core.TestDescriptor"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendLine($"TestId = \"{EscapeString(fullyQualifiedName)}\","); - writer.AppendLine($"ClassName = \"{EscapeString(simpleClassName)}\","); writer.AppendLine($"MethodName = \"{EscapeString(methodName)}\","); writer.AppendLine($"FullyQualifiedName = \"{EscapeString(fullyQualifiedName)}\","); writer.AppendLine($"FilePath = @\"{(testMethod.FilePath ?? "").Replace("\\", "\\\\")}\","); @@ -2519,116 +3076,44 @@ private static string PreGenerateDescriptorBlock(TestMethodMetadata testMethod, writer.AppendLine($"HasDataSource = {(hasDataSource ? "true" : "false")},"); writer.AppendLine($"RepeatCount = {repeatCount},"); writer.AppendLine($"DependsOn = {dependsOnArray},"); - writer.AppendLine($"Materializer = __Materialize_{methodId}"); - writer.Unindent(); - writer.AppendLine("};"); - - return writer.ToString(); - } - - /// - /// Pre-generates the full __InvokeTest_{id} static method (signature + body). - /// - private static string PreGenerateInvokeTestMethod(TestMethodMetadata testMethod, string className, string methodId) - { - var writer = new CodeWriter(includeHeader: false); - - var (hasCancellationToken, parametersFromArgs) = ParseInvokerParameters(testMethod.MethodSymbol); - var returnPattern = GetReturnPattern(testMethod.MethodSymbol); - - writer.AppendLine($"private static global::System.Threading.Tasks.ValueTask __InvokeTest_{methodId}({className} instance, object?[] args, global::System.Threading.CancellationToken cancellationToken)"); - writer.AppendLine("{"); - writer.Indent(); - GenerateConcreteTestInvokerBody(writer, testMethod.MethodSymbol.Name, returnPattern, hasCancellationToken, parametersFromArgs); - writer.Unindent(); - writer.AppendLine("}"); return writer.ToString(); } /// - /// Pre-generates the full __Materialize_{id} static method. - /// This is only called when --treenode-filter is used (never JIT'd in normal runs). - /// Uses factory calls for consistency, with inline shared locals (since this is a separate method). + /// Pre-generates shared local variable declarations for the top of GetTests() and Materialize(). + /// Generates __classMetadata and __classType locals that are referenced by factory calls. /// - private static string PreGenerateMaterializerMethod( - TestMethodMetadata testMethod, - string className, - string methodId, - int attributeGroupIndex) + private static string PreGenerateSharedLocals(INamedTypeSymbol typeSymbol, string className) { var writer = new CodeWriter(includeHeader: false); - - writer.AppendLine($"private static global::System.Collections.Generic.IReadOnlyList __Materialize_{methodId}(string testSessionId)"); - writer.AppendLine("{"); - writer.Indent(); - - var methodName = testMethod.MethodSymbol.Name; - var filePath = (testMethod.FilePath ?? "").Replace("\\", "\\\\"); - - // Inline shared locals (can't reference GetTests locals from a separate method) - // Use AppendRaw to properly indent the multi-line ClassMetadata expression - writer.AppendRaw(PreGenerateSharedLocals(testMethod.TypeSymbol, className)); - - // Build MethodMetadata factory call - var methodMetadataCall = GenerateMethodMetadataFactoryCall(testMethod.MethodSymbol); - - // TestMetadataFactory.Create call - writer.AppendLine($"var metadata = global::TUnit.Core.TestMetadataFactory.Create<{className}>("); - writer.Indent(); - writer.AppendLine($"\"{methodName}\", \"{methodName}\", {testMethod.LineNumber},"); - writer.AppendLine($"__InvokeTest_{methodId}, __CreateAttributes_{attributeGroupIndex}, CreateInstance,"); - writer.Append(methodMetadataCall); - - // Add optional named parameters - AppendOptionalFactoryParameters(writer, testMethod, className); - - writer.AppendLine(","); - if (!string.IsNullOrEmpty(filePath)) - { - writer.AppendLine($"filePath: @\"{filePath}\","); - } - writer.Append("testSessionId: testSessionId"); - - writer.Unindent(); - writer.AppendLine(");"); - writer.AppendLine("return new global::TUnit.Core.TestMetadata[] { metadata };"); - - writer.Unindent(); - writer.AppendLine("}"); - + var classMetadataExpr = MetadataGenerationHelper.GenerateClassMetadataGetOrAddWithParentExpression(typeSymbol, writer.IndentLevel); + writer.AppendLine($"var __classMetadata = {classMetadataExpr};"); + writer.AppendLine($"var __classType = typeof({className});"); return writer.ToString(); } /// - /// Pre-generates the attribute factory body for a test method. - /// Returns the body (return [...];) without the method signature. + /// Generates __classMetadata and __classType as static readonly fields instead of local variables. + /// Used by the per-class path to inline MethodMetadata construction into field initializers, + /// eliminating the separate __InitMethodMetadatas method and saving one JIT per class. /// - private static string PreGenerateAttributeFactoryBody(TestMethodMetadata testMethod) + private static string PreGenerateSharedFields(INamedTypeSymbol typeSymbol, string className) { var writer = new CodeWriter(includeHeader: false); - - writer.AppendLine("return"); - writer.AppendLine("["); - writer.Indent(); - testMethod.CompilationContext.AttributeWriter.WriteAttributes(writer, GetTestAttributes(testMethod)); - writer.Unindent(); - writer.AppendLine("];"); - + var classMetadataExpr = MetadataGenerationHelper.GenerateClassMetadataGetOrAddWithParentExpression(typeSymbol, writer.IndentLevel); + writer.AppendLine($"private static readonly global::TUnit.Core.ClassMetadata __classMetadata = {classMetadataExpr};"); + writer.AppendLine($"private static readonly global::System.Type __classType = typeof({className});"); return writer.ToString(); } /// - /// Pre-generates shared local variable declarations for the top of GetTests(). - /// Generates __classMetadata and __classType locals that are referenced by factory calls. + /// Pre-generates a MethodMetadataFactory.Create(...) expression for one method. + /// Called during the transform step where ISymbol is available. /// - private static string PreGenerateSharedLocals(INamedTypeSymbol typeSymbol, string className) + private static string PreGenerateMethodMetadataExpression(TestMethodMetadata testMethod) { - var writer = new CodeWriter(includeHeader: false); - var classMetadataExpr = MetadataGenerationHelper.GenerateClassMetadataGetOrAddWithParentExpression(typeSymbol, writer.IndentLevel); - writer.AppendLine($"var __classMetadata = {classMetadataExpr};"); - writer.AppendLine($"var __classType = typeof({className});"); - return writer.ToString(); + return GenerateMethodMetadataFactoryCall(testMethod.MethodSymbol); } /// @@ -2884,9 +3369,10 @@ private static IEnumerable GroupMethodsByClass(ImmutableArray m is not null).Select(m => m!).ToList(); - var attrBodies = methodsList.Select(m => PreGenerateAttributeFactoryBody(m)).ToList(); + + // Deduplicate attribute factory bodies + var attrBodies = methodsList.Select(PreGenerateCreateAttributesCode).ToList(); var bodyToIndex = new Dictionary(); var distinctBodies = new List(); foreach (var body in attrBodies) @@ -2907,7 +3393,6 @@ private static IEnumerable GroupMethodsByClass(ImmutableArray GroupMethodsByClass(ImmutableArray GroupMethodsByClass(ImmutableArray GetTests(string testSessionId)"); - writer.AppendLine("{"); - writer.Indent(); - - // Shared locals: __classMetadata and __classType (referenced by factory calls) - writer.AppendRaw(classGroup.SharedLocalsCode); + // Shared ClassMetadata + classType as static fields (no separate method needed) + writer.AppendRaw(classGroup.SharedFieldsCode); + // Per-method MethodMetadata as individual static fields (inlined, no array) foreach (var method in classGroup.Methods) { - writer.AppendRaw(method.MetadataCode); + writer.AppendLine($"private static readonly global::TUnit.Core.MethodMetadata __mm_{method.MethodIndex} = {method.MethodMetadataCode};"); } - writer.Append("return new global::TUnit.Core.TestMetadata[] { "); - for (int i = 0; i < classGroup.Methods.Length; i++) - { - if (i > 0) writer.Append(", "); - writer.Append($"metadata_{classGroup.Methods[i].MethodId}"); - } - writer.AppendLine(" };"); - + // CreateInstance — shared across all entries (1 per class) + writer.AppendLine($"private static {classGroup.ClassFullyQualified} __CreateInstance(global::System.Type[] typeArgs, object?[] args)"); + writer.AppendLine("{"); + writer.Indent(); + writer.AppendRaw(classGroup.InstanceFactoryBodyCode); writer.Unindent(); writer.AppendLine("}"); - // EnumerateTestDescriptors() — yields descriptors for ALL methods - writer.AppendLine("public static global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors()"); + // Consolidated __Invoke switch — 1 method for ALL tests in this class + writer.AppendLine($"private static global::System.Threading.Tasks.ValueTask __Invoke({classGroup.ClassFullyQualified} instance, int methodIndex, object?[] args, global::System.Threading.CancellationToken cancellationToken)"); + writer.AppendLine("{"); + writer.Indent(); + writer.AppendLine("switch (methodIndex)"); writer.AppendLine("{"); writer.Indent(); foreach (var method in classGroup.Methods) { - writer.AppendRaw(method.DescriptorCode); + writer.AppendRaw(method.InvokeSwitchCaseCode); } + writer.AppendLine("default:"); + writer.Indent(); + writer.AppendLine("throw new global::System.ArgumentOutOfRangeException(nameof(methodIndex));"); + writer.Unindent(); + writer.Unindent(); + writer.AppendLine("}"); writer.Unindent(); writer.AppendLine("}"); - // Shared __CreateAttributes_{index} methods - for (int i = 0; i < classGroup.AttributeGroups.Length; i++) + // Consolidated __Attributes switch — 1 method for ALL attribute groups in this class + // Always emitted (even if no groups) since TestEntry references it unconditionally + writer.AppendLine("private static global::System.Attribute[] __Attributes(int groupIndex)"); + writer.AppendLine("{"); + writer.Indent(); + if (classGroup.AttributeGroups.Length > 0) { - writer.AppendLine($"private static global::System.Attribute[] __CreateAttributes_{i}()"); + writer.AppendLine("switch (groupIndex)"); writer.AppendLine("{"); writer.Indent(); - writer.AppendRaw(classGroup.AttributeGroups[i]); + for (int i = 0; i < classGroup.AttributeGroups.Length; i++) + { + writer.AppendLine($"case {i}:"); + writer.AppendLine("{"); + writer.Indent(); + writer.AppendRaw(classGroup.AttributeGroups[i]); + writer.Unindent(); + writer.AppendLine("}"); + } + writer.AppendLine("default:"); + writer.Indent(); + writer.AppendLine("throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex));"); + writer.Unindent(); writer.Unindent(); writer.AppendLine("}"); } - - // Per-method __InvokeTest_{id} methods - foreach (var method in classGroup.Methods) + else { - writer.AppendRaw(method.InvokeTestMethod); + writer.AppendLine("throw new global::System.ArgumentOutOfRangeException(nameof(groupIndex));"); } + writer.Unindent(); + writer.AppendLine("}"); - // Per-method __Materialize_{id} methods (never JIT'd in normal runs) + // TestEntry[] array — all entries share the same 3 delegates + writer.AppendLine($"public static readonly global::TUnit.Core.TestEntry<{classGroup.ClassFullyQualified}>[] Entries = new global::TUnit.Core.TestEntry<{classGroup.ClassFullyQualified}>[]"); + writer.AppendLine("{"); + writer.Indent(); foreach (var method in classGroup.Methods) { - writer.AppendRaw(method.MaterializerMethod); + writer.AppendLine($"new global::TUnit.Core.TestEntry<{classGroup.ClassFullyQualified}>"); + writer.AppendLine("{"); + writer.Indent(); + writer.AppendRaw(method.TestEntryDataFieldsCode); + writer.AppendLine($"MethodMetadata = __mm_{method.MethodIndex},"); + writer.AppendLine($"CreateInstance = __CreateInstance,"); + writer.AppendLine($"InvokeBody = __Invoke,"); + writer.AppendLine($"MethodIndex = {method.MethodIndex},"); + writer.AppendLine($"CreateAttributes = __Attributes,"); + writer.AppendLine($"AttributeGroupIndex = {method.AttributeGroupIndex},"); + if (method.TestDataSourcesCode != null) + { + writer.AppendLine($"TestDataSources = {method.TestDataSourcesCode},"); + } + if (method.ClassDataSourcesCode != null) + { + writer.AppendLine($"ClassDataSources = {method.ClassDataSourcesCode},"); + } + if (method.DependenciesCode != null) + { + writer.AppendLine($"Dependencies = {method.DependenciesCode},"); + } + writer.Unindent(); + writer.AppendLine("},"); } - - // CreateInstance method (shared for all methods) - writer.AppendLine($"internal static {classGroup.ClassFullyQualified} CreateInstance(global::System.Type[] typeArgs, object?[] args)"); - writer.AppendLine("{"); - writer.Indent(); - writer.AppendRaw(classGroup.InstanceFactoryBodyCode); writer.Unindent(); - writer.AppendLine("}"); + writer.AppendLine("};"); writer.Unindent(); writer.AppendLine("}"); + // Registration EmitRegistrationField(writer, classGroup.TestSourceName, - $"global::TUnit.Core.SourceRegistrar.RegisterReturn(typeof({classGroup.ClassFullyQualified}), {classGroup.TestSourceName}.GetTests, {classGroup.TestSourceName}.EnumerateTestDescriptors)"); + $"global::TUnit.Core.SourceRegistrar.RegisterEntries({classGroup.TestSourceName}.Entries)"); context.AddSource($"{classGroup.TestSourceName}.g.cs", SourceText.From(writer.ToString(), Encoding.UTF8)); } diff --git a/TUnit.Core.SourceGenerator/Models/ClassTestGroup.cs b/TUnit.Core.SourceGenerator/Models/ClassTestGroup.cs index 3540918403..e0fb7bc383 100644 --- a/TUnit.Core.SourceGenerator/Models/ClassTestGroup.cs +++ b/TUnit.Core.SourceGenerator/Models/ClassTestGroup.cs @@ -1,50 +1,27 @@ namespace TUnit.Core.SourceGenerator.Models; /// -/// A per-class grouping model for generating a consolidated TestSource. +/// A per-class grouping model for generating a TestSource with TestEntry<T> array. /// Contains only primitives/strings (no ISymbol references) for incremental caching. /// public sealed record ClassTestGroup { - /// - /// The fully qualified class name with global:: prefix. - /// e.g. "global::MyNamespace.MyClass" - /// public required string ClassFullyQualified { get; init; } - - /// - /// The safe identifier name for the per-class TestSource. - /// e.g. "MyNamespace_MyClass__TestSource" - /// public required string TestSourceName { get; init; } - - /// - /// Pre-generated code for each test method in this class. - /// public required EquatableArray Methods { get; init; } /// - /// Deduplicated attribute factory method bodies. - /// Index corresponds to TestMethodSourceCode.AttributeGroupIndex. - /// Methods with identical attributes share the same body. + /// Deduplicated attribute factory bodies. Methods with identical attributes share the same index. /// public required EquatableArray AttributeGroups { get; init; } - /// - /// Pre-generated C# code for the CreateInstance method body. - /// Generated during the transform step where ISymbol is available. - /// public required string InstanceFactoryBodyCode { get; init; } - - /// - /// Pre-generated UnsafeAccessor declarations for init-only properties with data sources. - /// Empty string if none needed. - /// public required string ReflectionFieldAccessorsCode { get; init; } + public required string SharedLocalsCode { get; init; } /// - /// Pre-generated shared local variable declarations (ClassMetadata, classType) - /// emitted once at the top of GetTests(). + /// Pre-generated static readonly field declarations for ClassMetadata and classType. + /// Used to inline MethodMetadata construction into field initializers. /// - public required string SharedLocalsCode { get; init; } + public required string SharedFieldsCode { get; init; } } diff --git a/TUnit.Core.SourceGenerator/Models/TestMethodSourceCode.cs b/TUnit.Core.SourceGenerator/Models/TestMethodSourceCode.cs index bdc18bfe76..35f5f24b1c 100644 --- a/TUnit.Core.SourceGenerator/Models/TestMethodSourceCode.cs +++ b/TUnit.Core.SourceGenerator/Models/TestMethodSourceCode.cs @@ -6,41 +6,18 @@ namespace TUnit.Core.SourceGenerator.Models; /// public sealed record TestMethodSourceCode { - /// - /// Safe unique identifier within the class (handles overloads via parameter types). - /// e.g. "MyMethod" or "MyMethod__Int32_String" - /// public required string MethodId { get; init; } + public required int MethodIndex { get; init; } + public required int AttributeGroupIndex { get; init; } + public required string MethodMetadataCode { get; init; } - /// - /// Pre-generated metadata block for GetTests(). - /// Contains: var metadata_{id} = new TestMetadata<T> { ... }; metadata_{id}.UseRuntimeDataGeneration(...); - /// - public required string MetadataCode { get; init; } - - /// - /// Pre-generated descriptor block for EnumerateTestDescriptors(). - /// Contains: yield return new TestDescriptor { ..., Materializer = __Materialize_{id} }; - /// - public required string DescriptorCode { get; init; } - - /// - /// Pre-generated full __InvokeTest_{id} static method (signature + body). - /// - public required string InvokeTestMethod { get; init; } + /// Switch case body for the class-level __Invoke method. + public required string InvokeSwitchCaseCode { get; init; } - /// - /// Pre-generated full __Materialize_{id} static method (signature + body). - /// The metadata code here intentionally duplicates MetadataCode rather than extracting a shared - /// BuildMetadata_{id} helper, because such helpers would each be JIT-compiled (adding 10,000 JITs - /// in the repro scenario), negating the optimization. Materializers are never JIT'd in normal runs - /// (only when --treenode-filter is used), so the duplication has zero runtime cost. - /// - public required string MaterializerMethod { get; init; } + /// TestEntry data fields (MethodName, FilePath, etc.). + public required string TestEntryDataFieldsCode { get; init; } - /// - /// Index into the shared AttributeGroups array in ClassTestGroup. - /// Methods with identical attribute factory bodies share the same index. - /// - public required int AttributeGroupIndex { get; init; } + public string? TestDataSourcesCode { get; init; } + public string? ClassDataSourcesCode { get; init; } + public string? DependenciesCode { get; init; } } diff --git a/TUnit.Core/ITestEntrySource.cs b/TUnit.Core/ITestEntrySource.cs new file mode 100644 index 0000000000..50908e2cbb --- /dev/null +++ b/TUnit.Core/ITestEntrySource.cs @@ -0,0 +1,42 @@ +using System.ComponentModel; + +namespace TUnit.Core; + +/// +/// Non-generic interface for the engine to access test entries without knowing T. +/// Each TestEntrySource<T> implements this to provide materialization. +/// +#if !DEBUG +[EditorBrowsable(EditorBrowsableState.Never)] +#endif +public interface ITestEntrySource +{ + /// Number of test entries. + int Count { get; } + + /// The test class type. + Type ClassType { get; } + + /// Get the class name for filtering (from the first entry). + string ClassName { get; } + + /// Get entry data for filtering at the given index. + TestEntryFilterData GetFilterData(int index); + + /// Materialize a TestMetadata for the entry at the given index. + IReadOnlyList Materialize(int index, string testSessionId); +} + +/// +/// Lightweight data extracted from a TestEntry for filtering — no delegates, no JIT. +/// +public readonly struct TestEntryFilterData +{ + public required string MethodName { get; init; } + public required string ClassName { get; init; } + public required string[] Categories { get; init; } + public required string[] Properties { get; init; } + public required string[] DependsOn { get; init; } + public required bool HasDataSource { get; init; } + public required int RepeatCount { get; init; } +} diff --git a/TUnit.Core/InjectableProperty.cs b/TUnit.Core/InjectableProperty.cs new file mode 100644 index 0000000000..b0f3e60681 --- /dev/null +++ b/TUnit.Core/InjectableProperty.cs @@ -0,0 +1,35 @@ +using System.ComponentModel; + +namespace TUnit.Core; + +/// +/// Describes a property on a test class that has an IDataSourceAttribute and needs injection. +/// Source-generated: the source generator identifies these at compile time and emits the setter delegate, +/// eliminating reflection-based property discovery at runtime. +/// +#if !DEBUG +[EditorBrowsable(EditorBrowsableState.Never)] +#endif +public sealed class InjectableProperty +{ + /// + /// The property name. + /// + public required string Name { get; init; } + + /// + /// The property type. + /// + public required Type Type { get; init; } + + /// + /// The data source attribute on this property. + /// + public required IDataSourceAttribute DataSource { get; init; } + + /// + /// AOT-safe setter delegate. Calls the property setter without reflection. + /// Signature: (object instance, object? value) — the instance is cast internally. + /// + public required Action SetValue { get; init; } +} diff --git a/TUnit.Core/Interfaces/SourceGenerator/DelegateTestSource.cs b/TUnit.Core/Interfaces/SourceGenerator/DelegateTestSource.cs deleted file mode 100644 index 8a364c9c9a..0000000000 --- a/TUnit.Core/Interfaces/SourceGenerator/DelegateTestSource.cs +++ /dev/null @@ -1,21 +0,0 @@ -namespace TUnit.Core.Interfaces.SourceGenerator; - -internal sealed class DelegateTestSource : ITestSource, ITestDescriptorSource -{ - private readonly Func> _getTests; - private readonly Func> _enumerateDescriptors; - - public DelegateTestSource( - Func> getTests, - Func> enumerateDescriptors) - { - _getTests = getTests; - _enumerateDescriptors = enumerateDescriptors; - } - - public IReadOnlyList GetTests(string testSessionId) - => _getTests(testSessionId); - - public IEnumerable EnumerateTestDescriptors() - => _enumerateDescriptors(); -} diff --git a/TUnit.Core/Interfaces/SourceGenerator/ITestDescriptorSource.cs b/TUnit.Core/Interfaces/SourceGenerator/ITestDescriptorSource.cs deleted file mode 100644 index 947a495a77..0000000000 --- a/TUnit.Core/Interfaces/SourceGenerator/ITestDescriptorSource.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace TUnit.Core.Interfaces.SourceGenerator; - -/// -/// Provides fast enumeration of test descriptors for filtering. -/// -/// -/// -/// This interface enables two-phase test discovery: -/// -/// -/// -/// Fast enumeration: returns lightweight -/// instances without materializing full metadata. -/// -/// -/// Lazy materialization: Only tests that pass filtering have their -/// invoked to create full . -/// -/// -/// -/// Implementing this interface is optional. Classes that only implement -/// will have a default implementation provided that materializes all tests. -/// -/// -public interface ITestDescriptorSource -{ - /// - /// Enumerates test descriptors without materializing full test metadata. - /// - /// - /// An enumerable of lightweight test descriptors that can be used for filtering. - /// Each descriptor contains a delegate - /// that can be invoked to create the full . - /// - /// - /// - /// This method should be fast and allocation-free where possible. - /// The returned descriptors should contain pre-computed filter hints - /// (categories, properties) extracted at compile time. - /// - /// - /// For parameterized tests, a single descriptor represents all data rows. - /// The actual data rows are enumerated when is invoked. - /// - /// - IEnumerable EnumerateTestDescriptors(); -} diff --git a/TUnit.Core/Interfaces/SourceGenerator/ITestSource.cs b/TUnit.Core/Interfaces/SourceGenerator/ITestSource.cs deleted file mode 100644 index 25f7ece7a0..0000000000 --- a/TUnit.Core/Interfaces/SourceGenerator/ITestSource.cs +++ /dev/null @@ -1,28 +0,0 @@ -namespace TUnit.Core.Interfaces.SourceGenerator; - -/// -/// Provides test metadata for test discovery and execution. -/// -/// -/// -/// For optimized test discovery, implementations can also implement -/// to enable two-phase discovery: -/// -/// -/// Fast enumeration via -/// Lazy materialization via -/// -/// -/// If is not implemented, the discovery pipeline -/// falls back to for all tests. -/// -/// -public interface ITestSource -{ - /// - /// Gets all test metadata for this test source. - /// - /// The test session identifier. - /// A read-only list of test metadata. - IReadOnlyList GetTests(string testSessionId); -} diff --git a/TUnit.Core/SourceRegistrar.cs b/TUnit.Core/SourceRegistrar.cs index ba6b38d159..0d1ebd97e6 100644 --- a/TUnit.Core/SourceRegistrar.cs +++ b/TUnit.Core/SourceRegistrar.cs @@ -33,43 +33,6 @@ public static void RegisterAssembly(Func assemblyLoader) Sources.AssemblyLoaders.Enqueue(assemblyLoader); } - /// - /// Registers a test source. - /// - /// The test source to register. - public static void Register(ITestSource testSource) - { - // For backward compatibility, add to all types queue if no type specified - var allTypesQueue = Sources.TestSources.GetOrAdd(typeof(object), static _ => new ConcurrentQueue()); - allTypesQueue.Enqueue(testSource); - } - - /// - /// Registers a test source for a specific test class type. - /// - /// The test class type. - /// The test source to register. - public static void Register(Type testClassType, ITestSource testSource) - { - var queue = Sources.TestSources.GetOrAdd(testClassType, static _ => new ConcurrentQueue()); - queue.Enqueue(testSource); - } - - /// - /// Registers a test source for a specific test class type using delegates. - /// This avoids allocating a unique TestSource type per class, reducing JIT overhead. - /// - /// The test class type. - /// Delegate that returns test metadata. - /// Delegate that enumerates test descriptors. - public static void Register( - Type testClassType, - Func> getTests, - Func> enumerateDescriptors) - { - Register(testClassType, new DelegateTestSource(getTests, enumerateDescriptors)); - } - /// /// Registers a test source. /// @@ -125,23 +88,41 @@ public static int RegisterHook(ConcurrentBag bag, T hook) } /// - /// Wrapper around that returns a dummy value for use as a field initializer. + /// Registers test entries for a class using the TestEntry pattern. + /// Returns a dummy value for use as a static field initializer. + /// Multiple calls for the same T are additive — entries accumulate. /// - public static int RegisterReturn(Type testClassType, ITestSource testSource) + public static int RegisterEntries<[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)] T>(TestEntry[] entries) where T : class { - Register(testClassType, testSource); - return 0; - } + if (entries is null || entries.Length == 0) + { + throw new InvalidOperationException( + $"Source-generated test registration failed: no entries for '{typeof(T).FullName}'. " + + "This indicates a source generator bug. Please report this issue."); + } - /// - /// Wrapper around that returns a dummy value for use as a field initializer. - /// - public static int RegisterReturn( - Type testClassType, - Func> getTests, - Func> enumerateDescriptors) - { - Register(testClassType, getTests, enumerateDescriptors); - return 0; + var key = typeof(T); + + while (true) + { + if (Sources.TestEntries.TryGetValue(key, out var existing)) + { + if (existing is TestEntrySource existingSource) + { + existingSource.AddEntries(entries); + return 0; + } + + throw new InvalidOperationException( + $"Type mismatch in TestEntries for '{typeof(T).FullName}': expected TestEntrySource<{typeof(T).Name}>, found {existing.GetType().Name}"); + } + + if (Sources.TestEntries.TryAdd(key, new TestEntrySource(entries))) + { + return 0; + } + + // Another thread added between TryGetValue and TryAdd — retry to merge + } } } diff --git a/TUnit.Core/Sources.cs b/TUnit.Core/Sources.cs index cb4fad8c23..a77d874a24 100644 --- a/TUnit.Core/Sources.cs +++ b/TUnit.Core/Sources.cs @@ -10,7 +10,6 @@ namespace TUnit.Core; public static class Sources { public static readonly ConcurrentQueue> AssemblyLoaders = []; - public static readonly ConcurrentDictionary> TestSources = new(Environment.ProcessorCount * 2, 1000); public static readonly ConcurrentQueue DynamicTestSources = []; public static readonly ConcurrentDictionary> BeforeTestHooks = new(); @@ -35,4 +34,7 @@ public static class Sources public static readonly ConcurrentQueue> GlobalInitializers = []; public static readonly ConcurrentQueue PropertySources = []; + + // TestEntry registration path (source-gen startup performance optimization) + public static readonly ConcurrentDictionary TestEntries = new(); } diff --git a/TUnit.Core/TestDescriptor.cs b/TUnit.Core/TestDescriptor.cs deleted file mode 100644 index 900c4e41a3..0000000000 --- a/TUnit.Core/TestDescriptor.cs +++ /dev/null @@ -1,154 +0,0 @@ -namespace TUnit.Core; - -/// -/// Lightweight test descriptor for fast enumeration and filtering. -/// Contains only the minimal information needed to identify and filter tests -/// without materializing full test metadata. -/// -/// -/// -/// This struct is designed to minimize allocations during test discovery. -/// The full is only created when -/// is invoked, which happens only for tests that pass filtering. -/// -/// -/// Filter hints (Categories, Properties) are pre-computed at compile time -/// by the source generator, avoiding runtime attribute instantiation. -/// -/// -public readonly struct TestDescriptor -{ - /// - /// Gets the unique identifier for this test. - /// Format: "{Namespace}.{ClassName}.{MethodName}:{DataIndex}" - /// - public required string TestId { get; init; } - - /// - /// Gets the simple name of the test class. - /// - public required string ClassName { get; init; } - - /// - /// Gets the name of the test method. - /// - public required string MethodName { get; init; } - - /// - /// Gets the fully qualified name of the test. - /// Format: "{Namespace}.{ClassName}.{MethodName}" - /// - public required string FullyQualifiedName { get; init; } - - /// - /// Gets the source file path where the test is defined. - /// - public required string FilePath { get; init; } - - /// - /// Gets the line number where the test is defined. - /// - public required int LineNumber { get; init; } - - /// - /// Gets the pre-extracted category values from CategoryAttribute. - /// Pre-computed at compile time to avoid runtime attribute instantiation. - /// - public string[] Categories { get; init; } - - /// - /// Gets the pre-extracted property values from PropertyAttribute. - /// Format: "key=value" pairs. - /// Pre-computed at compile time to avoid runtime attribute instantiation. - /// - public string[] Properties { get; init; } - - /// - /// Gets whether this test has data sources (is parameterized). - /// When true, materialization may yield multiple TestMetadata instances. - /// - public bool HasDataSource { get; init; } - - /// - /// Gets the repeat count from RepeatAttribute, or 0 if not present. - /// Pre-extracted to avoid attribute instantiation. - /// - public int RepeatCount { get; init; } - - /// - /// Gets the dependencies for this test (from DependsOnAttribute). - /// Pre-extracted at compile time to enable dependency expansion during filtering. - /// Format: "ClassName:MethodName" for cross-class, ":MethodName" for same-class, - /// "ClassName:" for all tests in class. - /// - public string[] DependsOn { get; init; } - - /// - /// Gets the factory delegate that creates the full TestMetadata. - /// Only invoked for tests that pass filtering. - /// - /// - /// The delegate accepts a test session ID and returns a list of TestMetadata. - /// For non-parameterized tests, this returns a single-element list. - /// For parameterized tests, this returns one element per data row. - /// - public required Func> Materializer { get; init; } - - /// - /// Initializes a new instance of the struct. - /// - public TestDescriptor() - { - Categories = []; - Properties = []; - DependsOn = []; - } - - /// - /// Checks if this test matches the specified category. - /// - /// The category to match. - /// True if the test has the specified category. - public bool HasCategory(string category) - { - var categories = Categories; - for (var i = 0; i < categories.Length; i++) - { - if (string.Equals(categories[i], category, StringComparison.OrdinalIgnoreCase)) - { - return true; - } - } - return false; - } - - /// - /// Checks if this test has the specified property. - /// - /// The property key. - /// The property value (optional, if null only key is checked). - /// True if the test has the specified property. - public bool HasProperty(string key, string? value = null) - { - var prefix = value == null ? $"{key}=" : $"{key}={value}"; - var properties = Properties; - for (var i = 0; i < properties.Length; i++) - { - if (value == null) - { - if (properties[i].StartsWith(prefix, StringComparison.OrdinalIgnoreCase)) - { - return true; - } - } - else - { - if (string.Equals(properties[i], prefix, StringComparison.OrdinalIgnoreCase)) - { - return true; - } - } - } - return false; - } -} diff --git a/TUnit.Core/TestEntry.cs b/TUnit.Core/TestEntry.cs new file mode 100644 index 0000000000..19aefa7c79 --- /dev/null +++ b/TUnit.Core/TestEntry.cs @@ -0,0 +1,174 @@ +using System.ComponentModel; +using System.Diagnostics.CodeAnalysis; + +namespace TUnit.Core; + +/// +/// A self-contained test registration unit emitted by the source generator. +/// Contains everything needed to filter, materialize, and execute a single test: +/// pure data for filtering, behavioral delegates for execution, and property +/// descriptors for injection — all without reflection at runtime. +/// +/// +/// +/// Delegate properties (InvokeBody, CreateAttributes, CreateInstance) are shared +/// across all entries in a class — they point to class-level switch methods. +/// Per-test differentiation is via MethodIndex and AttributeGroupIndex. +/// This means zero per-test methods in the generated assembly. +/// +/// +#if !DEBUG +[EditorBrowsable(EditorBrowsableState.Never)] +#endif +public sealed class TestEntry< + [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors + | DynamicallyAccessedMemberTypes.PublicProperties + | DynamicallyAccessedMemberTypes.PublicMethods)] T> where T : class +{ + // --- Identity (pure data for filtering — no JIT needed) --- + + /// Test method name. + public required string MethodName { get; init; } + + /// Fully qualified name: Namespace.Class.Method + public required string FullyQualifiedName { get; init; } + + /// Source file path. + public required string FilePath { get; init; } + + /// Source line number. + public required int LineNumber { get; init; } + + /// Pre-extracted categories for fast filtering. + public string[] Categories { get; init; } = []; + + /// Pre-extracted "key=value" property pairs for fast filtering. + public string[] Properties { get; init; } = []; + + /// Dependency strings for fast BFS filtering: "ClassName:MethodName". + public string[] DependsOn { get; init; } = []; + + /// Pre-built TestDependency objects for the engine's dependency resolver. + public TestDependency[] Dependencies { get; init; } = []; + + /// Whether this test has data sources. + public bool HasDataSource { get; init; } + + /// Repeat count from RepeatAttribute, or 0. + public int RepeatCount { get; init; } + + // --- Structural metadata (pre-built by source generator in .cctor) --- + + /// Pre-built method metadata (name, return type, parameters, class metadata). + public required MethodMetadata MethodMetadata { get; init; } + + // --- Class-level shared delegates (1 JIT each, shared by ALL entries in this class) --- + + /// + /// Consolidated class-level invoker. All tests in the class share this delegate; + /// each test dispatches via its MethodIndex. One JIT per class. + /// + public required Func InvokeBody { get; init; } + + /// Method index for InvokeBody dispatch. + public required int MethodIndex { get; init; } + + /// + /// Consolidated class-level attribute factory. All tests in the class share this delegate; + /// each test dispatches via its AttributeGroupIndex. One JIT per class. + /// + public required Func CreateAttributes { get; init; } + + /// Attribute group index for CreateAttributes dispatch. + public required int AttributeGroupIndex { get; init; } + + /// AOT-safe factory to create test class instances. Shared by all entries in class. + public required Func CreateInstance { get; init; } + + // --- Data sources (pre-separated by source generator — no runtime scanning needed) --- + + /// Method-level data source attributes (Arguments, MethodDataSource, etc.). + public IDataSourceAttribute[] TestDataSources { get; init; } = []; + + /// Class-level data source attributes. + public IDataSourceAttribute[] ClassDataSources { get; init; } = []; + + // --- Property injection (source-generated, no reflection needed) --- + + /// Properties with data source attributes that need injection. + public InjectableProperty[] InjectableProperties { get; init; } = []; + + /// + /// Constructs a TestMetadata<T> from this entry's data and delegates. + /// + // Cached delegates and arrays — built once from immutable fields + private Func? _cachedInvokeTypedTest; + private Func? _cachedAttributeFactory; + private PropertyDataSource[]? _cachedPropertyDataSources; + private PropertyInjectionData[]? _cachedPropertyInjections; + + internal TestMetadata ToTestMetadata(string testSessionId) + { + if (_cachedInvokeTypedTest is null) + Interlocked.CompareExchange(ref _cachedInvokeTypedTest, (instance, args, ct) => InvokeBody(instance, MethodIndex, args, ct), null); + if (_cachedAttributeFactory is null) + Interlocked.CompareExchange(ref _cachedAttributeFactory, () => CreateAttributes(AttributeGroupIndex), null); + + return new TestMetadata + { + TestName = MethodName, + TestClassType = typeof(T), + TestMethodName = MethodName, + Dependencies = Dependencies, + DataSources = TestDataSources, + ClassDataSources = ClassDataSources, + PropertyDataSources = _cachedPropertyDataSources ??= BuildPropertyDataSources(), + PropertyInjections = _cachedPropertyInjections ??= BuildPropertyInjections(), + InstanceFactory = CreateInstance, + InvokeTypedTest = _cachedInvokeTypedTest, + AttributeFactory = _cachedAttributeFactory, + FilePath = FilePath, + LineNumber = LineNumber, + MethodMetadata = MethodMetadata, + RepeatCount = RepeatCount > 0 ? RepeatCount : null, + TestSessionId = testSessionId, + }; + } + + private PropertyDataSource[] BuildPropertyDataSources() + { + if (InjectableProperties.Length == 0) return []; + var result = new PropertyDataSource[InjectableProperties.Length]; + for (var i = 0; i < InjectableProperties.Length; i++) + { + result[i] = new PropertyDataSource + { + PropertyName = InjectableProperties[i].Name, + PropertyType = InjectableProperties[i].Type, + DataSource = InjectableProperties[i].DataSource, + }; + } + return result; + } + + private PropertyInjectionData[] BuildPropertyInjections() + { + if (InjectableProperties.Length == 0) return []; + var result = new PropertyInjectionData[InjectableProperties.Length]; + for (var i = 0; i < InjectableProperties.Length; i++) + { + var prop = InjectableProperties[i]; + result[i] = new PropertyInjectionData + { + PropertyName = prop.Name, + PropertyType = prop.Type, + Setter = prop.SetValue, + // ValueFactory is populated by the engine's data generation pipeline at execution time. + // PropertyDataSources (on TestMetadata) provides the IDataSourceAttribute that generates + // the actual value; this factory is a placeholder that gets replaced before injection. + ValueFactory = static () => null, + }; + } + return result; + } +} diff --git a/TUnit.Core/TestEntrySource.cs b/TUnit.Core/TestEntrySource.cs new file mode 100644 index 0000000000..33f1b659e2 --- /dev/null +++ b/TUnit.Core/TestEntrySource.cs @@ -0,0 +1,67 @@ +using System.ComponentModel; +using System.Diagnostics.CodeAnalysis; + +namespace TUnit.Core; + +/// +/// Thin non-generic wrapper around TestEntry<T>[] for engine access. +/// Provides filter data extraction and delegates materialization to TestEntry<T>.ToTestMetadata(). +/// +#if !DEBUG +[EditorBrowsable(EditorBrowsableState.Never)] +#endif +public sealed class TestEntrySource< + [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors + | DynamicallyAccessedMemberTypes.PublicProperties + | DynamicallyAccessedMemberTypes.PublicMethods)] T> : ITestEntrySource where T : class +{ + private TestEntry[] _entries; + private readonly string _className; + + public TestEntrySource(TestEntry[] entries) + { + _entries = entries; + _className = TUnit.Core.Extensions.TestContextExtensions.GetNestedTypeName(typeof(T)); + } + + /// + /// Appends additional entries. Used when multiple source-gen files register entries for the same T. + /// Thread-safe via lock since static field initializers may run concurrently. + /// + internal void AddEntries(TestEntry[] additional) + { + lock (_lock) + { + var combined = new TestEntry[_entries.Length + additional.Length]; + Array.Copy(_entries, 0, combined, 0, _entries.Length); + Array.Copy(additional, 0, combined, _entries.Length, additional.Length); + _entries = combined; + } + } + + private readonly object _lock = new(); + + public int Count => _entries.Length; + public Type ClassType => typeof(T); + public string ClassName => _className; + + public TestEntryFilterData GetFilterData(int index) + { + var entry = _entries[index]; + return new TestEntryFilterData + { + MethodName = entry.MethodName, + ClassName = _className, + Categories = entry.Categories, + Properties = entry.Properties, + DependsOn = entry.DependsOn, + HasDataSource = entry.HasDataSource, + RepeatCount = entry.RepeatCount, + }; + } + + public IReadOnlyList Materialize(int index, string testSessionId) + { + return [_entries[index].ToTestMetadata(testSessionId)]; + } +} diff --git a/TUnit.Core/TestMetadataFactory.cs b/TUnit.Core/TestMetadataFactory.cs index 0cece67064..eede45aa20 100644 --- a/TUnit.Core/TestMetadataFactory.cs +++ b/TUnit.Core/TestMetadataFactory.cs @@ -5,9 +5,9 @@ namespace TUnit.Core; /// /// Factory for creating TestMetadata instances. -/// A single generic method Create<T>() where T : class gets JIT'd once by the .NET runtime -/// (reference types share native code), so replacing 1,000 inline object initializers with calls -/// to this shared factory dramatically reduces JIT-compiled native code size. +/// Used by the per-method source generation path (generic/inherited tests). +/// A single generic method gets JIT'd once by the .NET runtime (reference types +/// share native code), reducing JIT-compiled native code size. /// [EditorBrowsable(EditorBrowsableState.Never)] public static class TestMetadataFactory diff --git a/TUnit.Core/TestMetadata`1.cs b/TUnit.Core/TestMetadata`1.cs index 7fa09fe4b1..923ec7df27 100644 --- a/TUnit.Core/TestMetadata`1.cs +++ b/TUnit.Core/TestMetadata`1.cs @@ -1,3 +1,4 @@ +using System.ComponentModel; using System.Diagnostics.CodeAnalysis; using TUnit.Core.Helpers; using TUnit.Core.Interfaces; @@ -51,12 +52,13 @@ public class TestMetadata< /// /// Strongly typed test invoker with CancellationToken support. - /// Used by source generation mode. + /// Used by source generation mode (per-method delegates, generic/inherited tests). /// public Func? InvokeTypedTest { get; init; } + /// /// Factory delegate that creates an ExecutableTest for this metadata. /// @@ -70,17 +72,14 @@ public override Func { var typedMetadata = (TestMetadata)metadata; - // Create instance delegate that uses context Func> createInstance = async testContext => { - // If we have a factory from discovery, use it (for lazy instance creation) if (context.TestClassInstanceFactory != null) { return await context.TestClassInstanceFactory(); @@ -101,7 +100,6 @@ public override Func invokeTest = async (instance, args, testContext, cancellationToken) => { await typedMetadata.InvokeTypedTest!((T)instance, args, cancellationToken).ConfigureAwait(false); diff --git a/TUnit.Engine/Building/Collectors/AotTestDataCollector.cs b/TUnit.Engine/Building/Collectors/AotTestDataCollector.cs index 782414e16c..9a90277759 100644 --- a/TUnit.Engine/Building/Collectors/AotTestDataCollector.cs +++ b/TUnit.Engine/Building/Collectors/AotTestDataCollector.cs @@ -1,13 +1,10 @@ -using System.Collections.Concurrent; using System.Diagnostics.CodeAnalysis; using System.Linq.Expressions; using System.Reflection; using System.Runtime.CompilerServices; -using EnumerableAsyncProcessor.Extensions; using Microsoft.Testing.Platform.Requests; using TUnit.Core; using TUnit.Core.Interfaces; -using TUnit.Core.Interfaces.SourceGenerator; using TUnit.Engine.Building.Interfaces; using TUnit.Engine.Helpers; using TUnit.Engine.Services; @@ -40,152 +37,113 @@ public Task> CollectTestsAsync(string testSessionId) public async Task> CollectTestsAsync(string testSessionId, ITestExecutionFilter? filter) { var filterHints = MetadataFilterMatcher.ExtractFilterHints(filter); - IEnumerable standardTestMetadatas; + var allResults = new List(); - if (filterHints.HasHints && Sources.TestSources.All(static kvp => kvp.Value.All(static s => s is ITestDescriptorSource))) + if (!Sources.TestEntries.IsEmpty) { - standardTestMetadatas = CollectTestsWithTwoPhaseDiscovery( - Sources.TestSources, - testSessionId, - filterHints); - } - else - { - IEnumerable>> testSourcesByType = Sources.TestSources; - - if (filterHints.HasHints) - { - testSourcesByType = testSourcesByType.Where(kvp => filterHints.CouldTypeMatch(kvp.Key)); - } - - var testSourcesList = testSourcesByType.SelectMany(kvp => kvp.Value).ToList(); - standardTestMetadatas = CollectTests(testSourcesList, testSessionId); + allResults.AddRange(CollectTestsFromTestEntries(testSessionId, filterHints)); } - // Dynamic tests are typically rare, collect sequentially - var dynamicTestMetadatas = new List(); await foreach (var metadata in CollectDynamicTestsStreaming(testSessionId)) { - dynamicTestMetadatas.Add(metadata); + allResults.Add(metadata); } - return [..standardTestMetadatas, ..dynamicTestMetadatas]; + return allResults; } /// - /// Two-phase discovery with single-pass filtering and dependency resolution. - /// Accepts ALL test sources (with their associated types) and performs type-level - /// and descriptor-level filtering in a single enumeration pass, while indexing - /// all descriptors for dependency resolution. - /// - /// This avoids the previous double-enumeration where ExpandSourcesForDependencies - /// enumerated descriptors to find dependencies, and then this method enumerated - /// them again for filtering and materialization. + /// Collects tests from TestEntry sources (the new fast path). + /// Uses TestEntryFilterData for pure-data filtering, then materializes only matching entries. /// - private IEnumerable CollectTestsWithTwoPhaseDiscovery( - IEnumerable>> allSourcesByType, + #if NET6_0_OR_GREATER + [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Materialization uses source-generated metadata")] + #endif + private IEnumerable CollectTestsFromTestEntries( string testSessionId, FilterHints filterHints) { - // Phase 1: Single-pass enumeration over ALL sources with combined filtering - // - Index ALL descriptors (from all types) for dependency resolution - // - Apply type-level filter (assembly, namespace, class) per source group - // - Apply descriptor-level filter (class name, method name) per descriptor - // - Only descriptors passing BOTH filters are added to matchingDescriptors - // - Track if any matching descriptor has dependencies - var descriptorsByClassAndMethod = new Dictionary<(string ClassName, string MethodName), TestDescriptor>(); - var descriptorsByClass = new Dictionary>(); - var matchingDescriptors = new List(); + // Phase 1: Filter using pure data (no JIT of test-specific methods) + var totalEntries = Sources.TestEntries.Sum(static kvp => kvp.Value.Count); + var matching = new List<(ITestEntrySource Source, int Index)>(totalEntries); var hasDependencies = false; - foreach (var kvp in allSourcesByType) + foreach (var kvp in Sources.TestEntries) { - // Check type-level filter once per source group (covers assembly, namespace, class name) - var typeMatches = filterHints.CouldTypeMatch(kvp.Key); + var classType = kvp.Key; + var source = kvp.Value; + var typeMatches = !filterHints.HasHints || filterHints.CouldTypeMatch(classType); - foreach (var source in kvp.Value) + for (var i = 0; i < source.Count; i++) { - var descriptorSource = (ITestDescriptorSource)source; + var filterData = source.GetFilterData(i); - foreach (var descriptor in descriptorSource.EnumerateTestDescriptors()) + if (typeMatches && (!filterHints.HasHints || filterHints.CouldMatch(filterData.ClassName, filterData.MethodName))) { - // Always index for dependency resolution regardless of filter match - var key = (descriptor.ClassName, descriptor.MethodName); - descriptorsByClassAndMethod[key] = descriptor; - - if (!descriptorsByClass.TryGetValue(descriptor.ClassName, out var classDescriptors)) - { - classDescriptors = []; - descriptorsByClass[descriptor.ClassName] = classDescriptors; - } - classDescriptors.Add(descriptor); - - // Only add to matching set if both type-level and descriptor-level filters pass - if (typeMatches && filterHints.CouldDescriptorMatch(descriptor)) + matching.Add((source, i)); + if (filterData.DependsOn.Length > 0) { - matchingDescriptors.Add(descriptor); - if (descriptor.DependsOn.Length > 0) - { - hasDependencies = true; - } + hasDependencies = true; } } } } - // Phase 2: Expand dependencies only if any matching descriptor has them. - // Because all descriptors are indexed (not just filtered ones), cross-class - // and transitive dependencies are resolved correctly even when the dependency - // target was filtered out by type/descriptor hints. - HashSet? expandedSet = null; + // Phase 2: Expand dependencies via BFS (only if needed) + HashSet<(ITestEntrySource, int)>? expandedSet = null; if (hasDependencies) { - expandedSet = new HashSet(matchingDescriptors); - var queue = new Queue(matchingDescriptors); + var byClassAndMethod = new Dictionary<(string, string), (ITestEntrySource Source, int Index)>(); + var byClass = new Dictionary>(); - while (queue.Count > 0) + foreach (var kvp in Sources.TestEntries) { - var current = queue.Dequeue(); - var dependsOn = current.DependsOn; - - for (var i = 0; i < dependsOn.Length; i++) + var source = kvp.Value; + for (var i = 0; i < source.Count; i++) { - var dependency = dependsOn[i]; + var fd = source.GetFilterData(i); + var pair = (source, i); + byClassAndMethod[(fd.ClassName, fd.MethodName)] = pair; - // Parse dependency format: "ClassName:MethodName" - var separatorIndex = dependency.IndexOf(':'); - if (separatorIndex < 0) + if (!byClass.TryGetValue(fd.ClassName, out var list)) { - continue; + list = []; + byClass[fd.ClassName] = list; } + list.Add(pair); + } + } - var depClassName = separatorIndex == 0 - ? current.ClassName // Same-class dependency - : dependency.Substring(0, separatorIndex); - var depMethodName = dependency.Substring(separatorIndex + 1); + expandedSet = new HashSet<(ITestEntrySource, int)>(matching); + var queue = new Queue<(ITestEntrySource Source, int Index)>(matching); - if (depMethodName.Length > 0) + while (queue.Count > 0) + { + var current = queue.Dequeue(); + var fd = current.Source.GetFilterData(current.Index); + + foreach (var dep in fd.DependsOn) + { + var sep = dep.IndexOf(':'); + if (sep < 0) continue; + + var depClass = sep == 0 ? fd.ClassName : dep[..sep]; + var depMethod = dep[(sep + 1)..]; + + if (depMethod.Length > 0) { - // Specific method dependency - if (descriptorsByClassAndMethod.TryGetValue((depClassName, depMethodName), out var depDescriptor)) - { - if (expandedSet.Add(depDescriptor)) - { - queue.Enqueue(depDescriptor); - } - } + if (byClassAndMethod.TryGetValue((depClass, depMethod), out var depEntry) + && expandedSet.Add(depEntry)) + queue.Enqueue(depEntry); } else { - // Class-level dependency: all tests in class - if (descriptorsByClass.TryGetValue(depClassName, out var classDescriptors)) + if (byClass.TryGetValue(depClass, out var classEntries)) { - foreach (var depDescriptor in classDescriptors) + foreach (var depEntry in classEntries) { - if (expandedSet.Add(depDescriptor)) - { - queue.Enqueue(depDescriptor); - } + if (expandedSet.Add(depEntry)) + queue.Enqueue(depEntry); } } } @@ -193,13 +151,13 @@ private IEnumerable CollectTestsWithTwoPhaseDiscovery( } } - // Phase 3: Materialize matching descriptors (including dependencies) - var descriptorsToMaterialize = expandedSet ?? (IEnumerable)matchingDescriptors; + // Phase 3: Materialize + var toMaterialize = expandedSet ?? (IEnumerable<(ITestEntrySource Source, int Index)>)matching; var results = new List(); - foreach (var descriptor in descriptorsToMaterialize) + foreach (var (source, index) in toMaterialize) { - var materialized = descriptor.Materializer(testSessionId); + var materialized = source.Materialize(index, testSessionId); for (var i = 0; i < materialized.Count; i++) { results.Add(materialized[i]); @@ -209,35 +167,6 @@ private IEnumerable CollectTestsWithTwoPhaseDiscovery( return results; } - private List CollectTests( - List testSourcesList, - string testSessionId) - { - var batches = new IReadOnlyList[testSourcesList.Count]; - - Parallel.For(0, testSourcesList.Count, i => - { - batches[i] = testSourcesList[i].GetTests(testSessionId); - }); - - var totalCount = 0; - for (var i = 0; i < batches.Length; i++) - { - totalCount += batches[i].Count; - } - - var combined = new List(totalCount); - for (var i = 0; i < batches.Length; i++) - { - var batch = batches[i]; - for (var j = 0; j < batch.Count; j++) - { - combined.Add(batch[j]); - } - } - return combined; - } - [RequiresUnreferencedCode("Dynamic test collection requires expression compilation and reflection")] private async IAsyncEnumerable CollectDynamicTestsStreaming( string testSessionId, @@ -489,65 +418,4 @@ public override Func - /// Enumerates lightweight test descriptors for fast filtering. - /// For sources implementing ITestDescriptorSource, returns pre-computed descriptors. - /// For legacy sources, creates descriptors with default filter hints. - /// - public IEnumerable EnumerateDescriptors() - { - // Enumerate descriptors from all test sources - foreach (var kvp in Sources.TestSources) - { - foreach (var testSource in kvp.Value) - { - // Check if the source implements ITestDescriptorSource for optimized enumeration - if (testSource is ITestDescriptorSource descriptorSource) - { - foreach (var descriptor in descriptorSource.EnumerateTestDescriptors()) - { - yield return descriptor; - } - } - // For legacy sources without ITestDescriptorSource, we can't enumerate descriptors - // without materializing - these will need to use the fallback path - } - } - } - - /// - /// Materializes full test metadata from filtered descriptors. - /// Only called for tests that passed filtering, avoiding unnecessary materialization. - /// - public IEnumerable MaterializeFromDescriptors( - IEnumerable descriptors, - string testSessionId) - { - foreach (var descriptor in descriptors) - { - var materialized = descriptor.Materializer(testSessionId); - for (var i = 0; i < materialized.Count; i++) - { - yield return materialized[i]; - } - } - } - - /// - /// Gets test sources that don't implement ITestDescriptorSource. - /// These sources require full materialization for discovery. - /// - public IEnumerable GetLegacyTestSources() - { - foreach (var kvp in Sources.TestSources) - { - foreach (var testSource in kvp.Value) - { - if (testSource is not ITestDescriptorSource) - { - yield return testSource; - } - } - } - } } diff --git a/TUnit.Engine/Building/Interfaces/ITestDataCollector.cs b/TUnit.Engine/Building/Interfaces/ITestDataCollector.cs index 609b20e2ca..c698e5b7ee 100644 --- a/TUnit.Engine/Building/Interfaces/ITestDataCollector.cs +++ b/TUnit.Engine/Building/Interfaces/ITestDataCollector.cs @@ -23,22 +23,4 @@ internal interface ITestDataCollector /// Optional execution filter for pre-filtering test sources /// Collection of test metadata ready for processing Task> CollectTestsAsync(string testSessionId, ITestExecutionFilter? filter); - - /// - /// Enumerates lightweight test descriptors for fast filtering. - /// This is the first phase of two-phase discovery, allowing filtering without full materialization. - /// - /// Collection of test descriptors that can be filtered before materialization. - IEnumerable EnumerateDescriptors(); - - /// - /// Materializes full test metadata from filtered descriptors. - /// This is the second phase of two-phase discovery, only called for tests that passed filtering. - /// - /// Descriptors that passed filtering. - /// The test session identifier. - /// Collection of fully materialized test metadata. - IEnumerable MaterializeFromDescriptors( - IEnumerable descriptors, - string testSessionId); } diff --git a/TUnit.Engine/Discovery/ReflectionTestDataCollector.cs b/TUnit.Engine/Discovery/ReflectionTestDataCollector.cs index bb5e24024f..230c422a06 100644 --- a/TUnit.Engine/Discovery/ReflectionTestDataCollector.cs +++ b/TUnit.Engine/Discovery/ReflectionTestDataCollector.cs @@ -2366,161 +2366,4 @@ private static TestMetadata CreateFailedTestMetadataForDynamicTest(DynamicDiscov }; } - /// - /// Enumerates lightweight test descriptors for fast filtering. - /// In reflection mode, this scans assemblies to create descriptors without full materialization. - /// Note: Reflection mode is less optimized than source-gen mode since we can't pre-compute filter hints. - /// - public IEnumerable EnumerateDescriptors() - { - // In reflection mode, we don't have pre-computed descriptors like source-gen mode. - // We enumerate types and methods to create descriptors, but can't extract - // filter hints (categories, properties) without instantiating attributes. - // This provides the structure for two-phase discovery but with limited optimization. - - var allAssemblies = Assemblies; - foreach (var assembly in allAssemblies) - { - if (!ShouldScanAssembly(assembly)) - { - continue; - } - - var types = _assemblyTypesCache.GetOrAdd(assembly, asm => - { - try - { - return asm.GetTypes(); - } - catch (ReflectionTypeLoadException rtle) - { - return rtle.Types.Where(static x => x != null).ToArray()!; - } - catch - { - return []; - } - }); - - foreach (var type in types) - { - if (!type.IsClass || type.IsAbstract || IsCompilerGenerated(type)) - { - continue; - } - - // Skip generic type definitions for now - they're handled separately - if (type.IsGenericTypeDefinition) - { - continue; - } - - MethodInfo[] testMethods; - try - { - var inheritsTests = type.IsDefined(typeof(InheritsTestsAttribute), inherit: false); - if (inheritsTests) - { - var allMethods = GetAllTestMethods(type); - var testMethodsList = new List(); - foreach (var method in allMethods) - { - if (method.IsDefined(typeof(TestAttribute), inherit: false) && !method.IsAbstract) - { - testMethodsList.Add(method); - } - } - testMethods = testMethodsList.ToArray(); - } - else - { - var declaredMethods = type.GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly); - var testMethodsList = new List(declaredMethods.Length); - foreach (var method in declaredMethods) - { - if (method.IsDefined(typeof(TestAttribute), inherit: false) && !method.IsAbstract) - { - testMethodsList.Add(method); - } - } - testMethods = testMethodsList.ToArray(); - } - } - catch - { - continue; - } - - foreach (var method in testMethods) - { - // Create a descriptor for each test method - // In reflection mode, we can't pre-extract filter hints without instantiating attributes - var capturedType = type; - var capturedMethod = method; - - var nestedClassName = TUnit.Core.Extensions.TestContextExtensions.GetNestedTypeName(type); - yield return new TestDescriptor - { - TestId = $"{type.FullName}.{method.Name}", - ClassName = nestedClassName, - MethodName = method.Name, - FullyQualifiedName = $"{type.FullName}.{method.Name}", - FilePath = ExtractFilePath(method) ?? "Unknown", - LineNumber = ExtractLineNumber(method) ?? 0, - Categories = [], // Can't extract without attribute instantiation - Properties = [], // Can't extract without attribute instantiation - HasDataSource = method.IsDefined(typeof(IDataSourceAttribute), inherit: false) || - type.IsDefined(typeof(IDataSourceAttribute), inherit: false), - RepeatCount = 0, // Can't extract without attribute instantiation - Materializer = CreateReflectionMaterializer(capturedType, capturedMethod) - }; - } - } - } - } - - private static Func> CreateReflectionMaterializer( - [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors | DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] - Type type, - MethodInfo method) - { - return testSessionId => MaterializeSingleTest(type, method); - } - - private static TestMetadata[] MaterializeSingleTest( - [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors | DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] - Type type, - MethodInfo method) - { - TestMetadata metadata; - try - { - metadata = BuildTestMetadata(type, method); - } - catch (Exception ex) - { - metadata = CreateFailedTestMetadata(type, method, ex); - } - - return [metadata]; - } - - /// - /// Materializes full test metadata from filtered descriptors. - /// Only called for tests that passed filtering. - /// - public IEnumerable MaterializeFromDescriptors( - IEnumerable descriptors, - string testSessionId) - { - foreach (var descriptor in descriptors) - { - var materialized = descriptor.Materializer(testSessionId); - for (var i = 0; i < materialized.Count; i++) - { - yield return materialized[i]; - } - } - } - } diff --git a/TUnit.Engine/Services/MetadataFilterMatcher.cs b/TUnit.Engine/Services/MetadataFilterMatcher.cs index e7dac385a8..c72ee630c1 100644 --- a/TUnit.Engine/Services/MetadataFilterMatcher.cs +++ b/TUnit.Engine/Services/MetadataFilterMatcher.cs @@ -82,45 +82,27 @@ public bool CouldTypeMatch(Type type) return true; } - /// - /// Check if a test descriptor could match this filter based on the hints. - /// Uses pre-computed filter hints in the descriptor for fast matching. - /// Returns true if no hints or if the descriptor matches all available hints. - /// - /// - /// This method can filter by both ClassName and MethodName because dependency - /// expansion at the descriptor level ensures that dependencies are included - /// before this filter is applied. The DependsOn property on TestDescriptor - /// contains pre-computed dependency information from DependsOnAttribute. - /// - public bool CouldDescriptorMatch(TestDescriptor descriptor) + public bool CouldMatch(string testClassName, string testMethodName) { - // Check class name hint if (ClassName != null) { - // The filter ClassName may be "OuterClass+InnerClass" or just "InnerClass" - // The descriptor ClassName now includes nested hierarchy (e.g., "OuterClass+InnerClass") - if (descriptor.ClassName != ClassName - && !descriptor.ClassName.StartsWith(ClassName + "`") - && !descriptor.ClassName.EndsWith("+" + ClassName) - && !descriptor.ClassName.StartsWith(ClassName + "+")) + if (testClassName != ClassName + && !testClassName.StartsWith(ClassName + "`") + && !testClassName.EndsWith("+" + ClassName) + && !testClassName.StartsWith(ClassName + "+")) { return false; } } - // Check method name hint if (MethodName != null) { - if (descriptor.MethodName != MethodName) + if (testMethodName != MethodName) { return false; } } - // Note: We don't check assembly/namespace here because descriptors don't store that info - // The type-level filtering in CouldTypeMatch handles those hints during source enumeration - return true; } } diff --git a/TUnit.PerformanceBenchmarks/compare-branches.ps1 b/TUnit.PerformanceBenchmarks/compare-branches.ps1 new file mode 100644 index 0000000000..15e34d39be --- /dev/null +++ b/TUnit.PerformanceBenchmarks/compare-branches.ps1 @@ -0,0 +1,144 @@ +#!/usr/bin/env pwsh +# Compare TUnit startup performance between two git refs (branches/commits/tags) +# Usage: +# ./compare-branches.ps1 -Baseline main -Current HEAD +# ./compare-branches.ps1 -Baseline main -Current 001-sourcegen-startup-perf -Iterations 5 +# ./compare-branches.ps1 -BaselineFile benchmark-results/startup-baseline.json # Compare against saved baseline + +param( + [string]$Baseline = "main", + [string]$Current = "HEAD", + [string]$BaselineFile = "", + [int]$Iterations = 3, + [string]$Filter = "/*/*/*/*", + [string]$Configuration = "Release" +) + +$ErrorActionPreference = "Stop" +$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path +$repoRoot = Split-Path -Parent $scriptDir +$resultsDir = Join-Path $scriptDir "benchmark-results" + +New-Item -ItemType Directory -Force -Path $resultsDir | Out-Null + +Write-Host "============================================" -ForegroundColor Cyan +Write-Host " TUnit Branch Performance Comparison" -ForegroundColor Cyan +Write-Host "============================================" -ForegroundColor Cyan +Write-Host "" + +function Measure-Branch { + param( + [string]$Ref, + [string]$Label + ) + + Write-Host "--- Measuring: $Label ($Ref) ---" -ForegroundColor Yellow + + # Save current state + $originalBranch = git rev-parse --abbrev-ref HEAD 2>$null + $originalCommit = git rev-parse HEAD 2>$null + $hasStash = $false + + # Stash any uncommitted changes + $status = git status --porcelain 2>$null + if ($status) { + Write-Host " Stashing uncommitted changes..." -ForegroundColor DarkGray + git stash push -m "compare-branches temp stash" --quiet 2>$null + $hasStash = $true + } + + try { + # Checkout the target ref + Write-Host " Checking out $Ref..." -ForegroundColor DarkGray + git checkout $Ref --quiet 2>$null + if ($LASTEXITCODE -ne 0) { + Write-Host " Failed to checkout $Ref" -ForegroundColor Red + return $null + } + + # Run measurement + $measureScript = Join-Path $scriptDir "measure-startup.ps1" + & $measureScript -Iterations $Iterations -Filter $Filter -Configuration $Configuration + + # Find the latest results file + $latestResult = Get-ChildItem -Path $resultsDir -Filter "startup-*.json" | + Sort-Object LastWriteTime -Descending | + Select-Object -First 1 + + if ($latestResult) { + $data = Get-Content $latestResult.FullName | ConvertFrom-Json + return $data + } + return $null + } + finally { + # Restore original state + Write-Host " Restoring to $originalBranch..." -ForegroundColor DarkGray + git checkout $originalBranch --quiet 2>$null + if ($hasStash) { + git stash pop --quiet 2>$null + } + } +} + +# Run measurements +if ($BaselineFile -and (Test-Path $BaselineFile)) { + Write-Host "Using saved baseline: $BaselineFile" -ForegroundColor Green + $baselineData = Get-Content $BaselineFile | ConvertFrom-Json +} else { + $baselineData = Measure-Branch -Ref $Baseline -Label "Baseline" +} + +Write-Host "" +$currentData = Measure-Branch -Ref $Current -Label "Current" + +if (-not $baselineData -or -not $currentData) { + Write-Host "Failed to collect measurements for one or both branches." -ForegroundColor Red + exit 1 +} + +# Display comparison +Write-Host "" +Write-Host "============================================" -ForegroundColor Cyan +Write-Host " Comparison Results" -ForegroundColor Cyan +Write-Host "============================================" -ForegroundColor Cyan +Write-Host "" + +$bMedian = $baselineData.Summary.MedianMs +$cMedian = $currentData.Summary.MedianMs +$diff = $cMedian - $bMedian +$pct = if ($bMedian -gt 0) { ($diff / $bMedian) * 100 } else { 0 } + +$changeSymbol = if ($diff -lt 0) { "faster" } elseif ($diff -gt 0) { "slower" } else { "same" } +$changeColor = if ($diff -lt 0) { "Green" } elseif ($diff -gt 0) { "Red" } else { "Yellow" } + +Write-Host " Metric Baseline Current Change" -ForegroundColor White +Write-Host " ─────────────── ─────────────── ─────────────── ───────────────" +Write-Host (" Median {0,10}ms {1,10}ms " -f $bMedian.ToString('F0'), $cMedian.ToString('F0')) -NoNewline +Write-Host ("{0}{1}ms ({2}%)" -f $(if($diff -ge 0){"+"}else{""}), $diff.ToString('F0'), $pct.ToString('F1')) -ForegroundColor $changeColor + +Write-Host (" Average {0,10}ms {1,10}ms" -f $baselineData.Summary.AverageMs.ToString('F0'), $currentData.Summary.AverageMs.ToString('F0')) +Write-Host (" Min {0,10}ms {1,10}ms" -f $baselineData.Summary.MinMs.ToString('F0'), $currentData.Summary.MinMs.ToString('F0')) +Write-Host (" Max {0,10}ms {1,10}ms" -f $baselineData.Summary.MaxMs.ToString('F0'), $currentData.Summary.MaxMs.ToString('F0')) +Write-Host (" Tests {0,10} {1,10}" -f $baselineData.TestCount, $currentData.TestCount) + +Write-Host "" +Write-Host " Verdict: " -NoNewline +Write-Host "$($[math]::Abs($pct).ToString('F1'))% $changeSymbol" -ForegroundColor $changeColor +Write-Host "" + +# Save comparison +$comparison = @{ + Timestamp = Get-Date -Format "yyyy-MM-dd_HH-mm-ss" + Baseline = @{ Ref = $Baseline; Summary = $baselineData.Summary; TestCount = $baselineData.TestCount } + Current = @{ Ref = $Current; Summary = $currentData.Summary; TestCount = $currentData.TestCount } + Change = @{ + MedianDiffMs = [math]::Round($diff, 1) + MedianDiffPercent = [math]::Round($pct, 1) + Direction = $changeSymbol + } +} + +$compFile = Join-Path $resultsDir "comparison-$($comparison.Timestamp).json" +$comparison | ConvertTo-Json -Depth 5 | Out-File -FilePath $compFile -Encoding utf8 +Write-Host " Saved to: $compFile" -ForegroundColor DarkGray diff --git a/TUnit.PerformanceBenchmarks/count-generated-methods.ps1 b/TUnit.PerformanceBenchmarks/count-generated-methods.ps1 new file mode 100644 index 0000000000..462e4f46f8 --- /dev/null +++ b/TUnit.PerformanceBenchmarks/count-generated-methods.ps1 @@ -0,0 +1,136 @@ +#!/usr/bin/env pwsh +# Count generated source-generator methods in a compiled TUnit assembly +# Uses binary string scanning — no assembly loading needed +# +# Usage: +# ./count-generated-methods.ps1 # Auto-detect from benchmark build +# ./count-generated-methods.ps1 -AssemblyPath path/to/assembly.dll + +param( + [string]$AssemblyPath = "", + [string]$Configuration = "Release" +) + +$ErrorActionPreference = "Stop" +$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path + +if (-not $AssemblyPath) { + $AssemblyPath = Join-Path $scriptDir "bin" $Configuration "net9.0" "TUnit.PerformanceBenchmarks.dll" +} + +if (-not (Test-Path $AssemblyPath)) { + Write-Host "Assembly not found: $AssemblyPath" -ForegroundColor Red + Write-Host "Build first: dotnet build -c $Configuration" -ForegroundColor Yellow + exit 1 +} + +Write-Host "============================================" -ForegroundColor Cyan +Write-Host " Generated Method Count Analysis" -ForegroundColor Cyan +Write-Host "============================================" -ForegroundColor Cyan +Write-Host "" +Write-Host "Assembly: $(Split-Path -Leaf $AssemblyPath)" -ForegroundColor White +Write-Host "Size: $([math]::Round((Get-Item $AssemblyPath).Length / 1MB, 2)) MB" +Write-Host "" + +# Read the binary and extract ASCII strings (method names are in the metadata string heap) +$content = [System.IO.File]::ReadAllText($AssemblyPath, [System.Text.Encoding]::ASCII) + +# Count method patterns in the string table +# These patterns are unique to source-generated code + +# __InvokeTest_ appears once per test method +$invokeTestMatches = [regex]::Matches($content, "__InvokeTest_[A-Za-z0-9_]+") +$invokeTestMethods = ($invokeTestMatches | Select-Object -ExpandProperty Value -Unique).Count + +# __Materialize_ appears once per test method (deferred) +$materializeMatches = [regex]::Matches($content, "__Materialize_[A-Za-z0-9_]+") +$materializeMethods = ($materializeMatches | Select-Object -ExpandProperty Value -Unique).Count + +# __CreateAttributes_ appears for each unique attribute group +$createAttrMatches = [regex]::Matches($content, "__CreateAttributes_\d+") +$createAttributeMethods = ($createAttrMatches | Select-Object -ExpandProperty Value -Unique).Count + +# Count TestSource class names (they appear as type names in metadata) +$testSourceMatches = [regex]::Matches($content, "[A-Za-z0-9_]+__TestSource") +$testSourceTypes = ($testSourceMatches | Select-Object -ExpandProperty Value -Unique).Count + +# Count _r_ registration fields +$regFieldMatches = [regex]::Matches($content, "_r_[A-Za-z0-9_]+__TestSource") +$registrationFields = ($regFieldMatches | Select-Object -ExpandProperty Value -Unique).Count + +# GetTests and EnumerateTestDescriptors are standard names — count by TestSource types +# (each TestSource class has exactly 1 GetTests and 1 EnumerateTestDescriptors) +$getTestsMethods = $testSourceTypes +$enumerateDescriptorMethods = $testSourceTypes + +# CreateInstance — one per TestSource class +$createInstanceMethods = $testSourceTypes + +$totalGenerated = $invokeTestMethods + $materializeMethods + $getTestsMethods + + $enumerateDescriptorMethods + $createAttributeMethods + $createInstanceMethods + +$startupJit = $invokeTestMethods + $getTestsMethods + $enumerateDescriptorMethods + + $createAttributeMethods + $createInstanceMethods + +Write-Host " Type Counts:" -ForegroundColor Yellow +Write-Host " TestSource classes: $testSourceTypes" +Write-Host " Registration fields: $registrationFields" +Write-Host "" +Write-Host " Method Counts:" -ForegroundColor Yellow +Write-Host " __InvokeTest_* methods: $invokeTestMethods " -NoNewline +Write-Host "(JIT'd at startup)" -ForegroundColor Red +Write-Host " __Materialize_* methods: $materializeMethods " -NoNewline +Write-Host "(deferred)" -ForegroundColor Green +Write-Host " GetTests methods: $getTestsMethods " -NoNewline +Write-Host "(JIT'd at startup)" -ForegroundColor Red +Write-Host " EnumerateTestDescriptors: $enumerateDescriptorMethods " -NoNewline +Write-Host "(JIT'd at startup)" -ForegroundColor Red +Write-Host " __CreateAttributes_*: $createAttributeMethods " -NoNewline +Write-Host "(JIT'd at startup)" -ForegroundColor Red +Write-Host " CreateInstance methods: $createInstanceMethods " -NoNewline +Write-Host "(JIT'd at startup)" -ForegroundColor Red +Write-Host "" +Write-Host " Summary:" -ForegroundColor Cyan +Write-Host " Total generated methods: $totalGenerated" -ForegroundColor White +Write-Host " Est. JIT'd at startup: $startupJit" -ForegroundColor Red +Write-Host " Deferred (materializers): $materializeMethods" -ForegroundColor Green +Write-Host "" + +# Target comparison +$targetStartupJit = 3 # After optimization: ~3 methods at startup +$reduction = if ($startupJit -gt 0) { [math]::Round((1 - $targetStartupJit / $startupJit) * 100, 1) } else { 0 } +Write-Host " Target (after optimization):" -ForegroundColor Yellow +Write-Host " Current startup JIT: $startupJit methods" +Write-Host " Target startup JIT: ~$targetStartupJit methods" +Write-Host " Targeted reduction: $reduction%" +Write-Host "" + +# Save as JSON +$resultsDir = Join-Path $scriptDir "benchmark-results" +New-Item -ItemType Directory -Force -Path $resultsDir | Out-Null + +$timestamp = Get-Date -Format "yyyy-MM-dd_HH-mm-ss" +$report = @{ + Timestamp = $timestamp + Assembly = Split-Path -Leaf $AssemblyPath + AssemblySizeMB = [math]::Round((Get-Item $AssemblyPath).Length / 1MB, 2) + Configuration = $Configuration + TypeCounts = @{ + TestSourceTypes = $testSourceTypes + RegistrationFields = $registrationFields + } + MethodCounts = @{ + InvokeTest = $invokeTestMethods + Materialize = $materializeMethods + GetTests = $getTestsMethods + EnumerateTestDescriptors = $enumerateDescriptorMethods + CreateAttributes = $createAttributeMethods + CreateInstance = $createInstanceMethods + TotalGenerated = $totalGenerated + EstimatedStartupJit = $startupJit + } +} + +$reportFile = Join-Path $resultsDir "method-count-$timestamp.json" +$report | ConvertTo-Json -Depth 5 | Out-File -FilePath $reportFile -Encoding utf8 +Write-Host " Results saved to: $reportFile" -ForegroundColor DarkGray diff --git a/TUnit.PerformanceBenchmarks/measure-jit.ps1 b/TUnit.PerformanceBenchmarks/measure-jit.ps1 new file mode 100644 index 0000000000..3c5da96497 --- /dev/null +++ b/TUnit.PerformanceBenchmarks/measure-jit.ps1 @@ -0,0 +1,200 @@ +#!/usr/bin/env pwsh +# Measure JIT compilation count during TUnit startup using dotnet-counters +# This captures the number of methods JIT-compiled, which is our primary optimization target. +# +# Usage: +# ./measure-jit.ps1 # Default: full run +# ./measure-jit.ps1 -Filter "/*/*/SimpleTests_01/*" # Filtered run +# +# Prerequisites: +# dotnet tool install --global dotnet-counters +# dotnet tool install --global dotnet-trace (for detailed JIT trace) + +param( + [string]$Filter = "/*/*/*/*", + [string]$Configuration = "Release", + [switch]$DetailedTrace, + [switch]$SkipBuild +) + +$ErrorActionPreference = "Stop" +$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path +$projectFile = Join-Path $scriptDir "TUnit.PerformanceBenchmarks.csproj" +$resultsDir = Join-Path $scriptDir "benchmark-results" + +New-Item -ItemType Directory -Force -Path $resultsDir | Out-Null + +$timestamp = Get-Date -Format "yyyy-MM-dd_HH-mm-ss" + +Write-Host "============================================" -ForegroundColor Cyan +Write-Host " TUnit JIT Compilation Measurement" -ForegroundColor Cyan +Write-Host "============================================" -ForegroundColor Cyan +Write-Host "" + +# Build +if (-not $SkipBuild) { + Write-Host "[1/3] Building $Configuration..." -ForegroundColor Yellow + dotnet build $projectFile -c $Configuration --no-incremental -v q 2>&1 | Out-Null + if ($LASTEXITCODE -ne 0) { + Write-Host "Build failed!" -ForegroundColor Red + exit 1 + } + Write-Host " Done" -ForegroundColor Green +} + +# Find executable +$tfm = "net9.0" +$exeDir = Join-Path $scriptDir "bin" $Configuration $tfm +$exeName = "TUnit.PerformanceBenchmarks" +if ($IsWindows -or $env:OS -match "Windows") { + $exePath = Join-Path $exeDir "$exeName.exe" +} else { + $exePath = Join-Path $exeDir $exeName +} + +Write-Host "" +Write-Host "[2/3] Measuring JIT compilations..." -ForegroundColor Yellow +Write-Host " Filter: $Filter" +Write-Host "" + +if ($DetailedTrace) { + # Use dotnet-trace for detailed JIT method list + $traceFile = Join-Path $resultsDir "jit-trace-$timestamp.nettrace" + + Write-Host " Collecting detailed JIT trace..." -ForegroundColor DarkGray + Write-Host " (This captures every JIT'd method name)" -ForegroundColor DarkGray + + # Start the process and collect JIT events + $env:DOTNET_JitCollect64BitCounts = "1" + $env:COMPlus_JitCollect64BitCounts = "1" + + if (Get-Command dotnet-trace -ErrorAction SilentlyContinue) { + dotnet-trace collect ` + --providers "Microsoft-Windows-DotNETRuntime:0x10:5" ` + --output $traceFile ` + -- $exePath --treenode-filter "$Filter" --exit-on-process-exit 2>&1 | Out-Null + + Write-Host " Trace saved to: $traceFile" -ForegroundColor Green + Write-Host " View with: dotnet-trace convert $traceFile --format Speedscope" -ForegroundColor DarkGray + } else { + Write-Host " dotnet-trace not found. Install with: dotnet tool install --global dotnet-trace" -ForegroundColor Red + } +} else { + # Use environment variable to enable JIT compilation logging + # This is lighter weight than dotnet-trace + + # Method 1: Use DOTNET_JitDisasm environment variable won't work (too verbose) + # Method 2: Use ETW events via dotnet-counters for aggregate count + # Method 3: Simple approach - use runtime events + + # The simplest reliable approach: run with JIT ETW events and count MethodJittingStarted events + $env:DOTNET_EnableDiagnostics = "1" + + # Run the test and capture output + timing + $sw = [System.Diagnostics.Stopwatch]::StartNew() + $output = & $exePath --treenode-filter "$Filter" --diagnostic-verbosity high --exit-on-process-exit 2>&1 + $sw.Stop() + + $exitCode = $LASTEXITCODE + $wallTimeMs = $sw.Elapsed.TotalMilliseconds + + # Parse test count + $testCount = 0 + foreach ($line in $output) { + if ($line -match "Total:\s*(\d+)") { $testCount = [int]$Matches[1] } + } + + Write-Host "" + Write-Host "[3/3] Results" -ForegroundColor Yellow + Write-Host "" + Write-Host " Wall-Clock Time: $($wallTimeMs.ToString('F0'))ms" -ForegroundColor Cyan + Write-Host " Tests Discovered: $testCount" -ForegroundColor Cyan + Write-Host "" +} + +# Count generated methods in source-generator output (static analysis) +Write-Host " Static Analysis (generated method count):" -ForegroundColor Cyan + +$generatedDir = Join-Path $scriptDir "obj" $Configuration $tfm "generated" "TUnit.Core.SourceGenerator" "TUnit.Core.SourceGenerator.Generators.TestMetadataGenerator" + +if (Test-Path $generatedDir) { + $generatedFiles = Get-ChildItem -Path $generatedDir -Filter "*.g.cs" -Recurse + + $totalMethods = 0 + $invokeMethods = 0 + $materializeMethods = 0 + $getTestsMethods = 0 + $enumerateDescriptorMethods = 0 + $attributeMethods = 0 + $createInstanceMethods = 0 + $testSourceClasses = 0 + + foreach ($file in $generatedFiles) { + $content = Get-Content $file.FullName -Raw + + # Count different method types + $m = [regex]::Matches($content, "__InvokeTest_") + $invokeMethods += $m.Count + + $m = [regex]::Matches($content, "__Materialize_") + $materializeMethods += $m.Count + + $m = [regex]::Matches($content, "GetTests\(") + $getTestsMethods += $m.Count + + $m = [regex]::Matches($content, "EnumerateTestDescriptors\(") + $enumerateDescriptorMethods += $m.Count + + $m = [regex]::Matches($content, "__CreateAttributes_") + $attributeMethods += $m.Count + + $m = [regex]::Matches($content, "CreateInstance\(") + $createInstanceMethods += $m.Count + + if ($content -match "TestSource") { + $testSourceClasses++ + } + } + + $totalMethods = $invokeMethods + $materializeMethods + $getTestsMethods + $enumerateDescriptorMethods + $attributeMethods + $createInstanceMethods + + Write-Host " Generated files: $($generatedFiles.Count)" + Write-Host " TestSource classes: $testSourceClasses" + Write-Host " __InvokeTest_* methods: $invokeMethods (JIT'd at startup)" + Write-Host " __Materialize_* methods: $materializeMethods (deferred, only with filter)" + Write-Host " GetTests methods: $getTestsMethods" + Write-Host " EnumerateTestDescriptors: $enumerateDescriptorMethods" + Write-Host " __CreateAttributes_*: $attributeMethods" + Write-Host " CreateInstance methods: $createInstanceMethods" + Write-Host "" + Write-Host " Total generated methods: $totalMethods" -ForegroundColor White + Write-Host " JIT'd at startup (est.): $($invokeMethods + $getTestsMethods + $enumerateDescriptorMethods + $attributeMethods + $createInstanceMethods)" -ForegroundColor Yellow + Write-Host " Deferred (materializers): $materializeMethods" -ForegroundColor Green +} else { + Write-Host " Generated source directory not found. Build first with -Configuration $Configuration" -ForegroundColor DarkYellow + Write-Host " Expected: $generatedDir" -ForegroundColor DarkGray +} + +# Save report +$report = @{ + Timestamp = $timestamp + Configuration = $Configuration + Filter = $Filter + WallTimeMs = if ($sw) { [math]::Round($wallTimeMs, 1) } else { $null } + TestCount = $testCount + GeneratedMethodCounts = @{ + InvokeTest = $invokeMethods + Materialize = $materializeMethods + GetTests = $getTestsMethods + EnumerateTestDescriptors = $enumerateDescriptorMethods + CreateAttributes = $attributeMethods + CreateInstance = $createInstanceMethods + Total = $totalMethods + EstimatedStartupJit = $invokeMethods + $getTestsMethods + $enumerateDescriptorMethods + $attributeMethods + $createInstanceMethods + } +} + +$reportFile = Join-Path $resultsDir "jit-$timestamp.json" +$report | ConvertTo-Json -Depth 5 | Out-File -FilePath $reportFile -Encoding utf8 +Write-Host "" +Write-Host " Results saved to: $reportFile" -ForegroundColor DarkGray diff --git a/TUnit.PerformanceBenchmarks/measure-startup.ps1 b/TUnit.PerformanceBenchmarks/measure-startup.ps1 new file mode 100644 index 0000000000..779728b121 --- /dev/null +++ b/TUnit.PerformanceBenchmarks/measure-startup.ps1 @@ -0,0 +1,178 @@ +#!/usr/bin/env pwsh +# Measure TUnit source-gen vs reflection startup performance +# Usage: +# ./measure-startup.ps1 # Default: 3 iterations, Release build +# ./measure-startup.ps1 -Iterations 5 # More iterations for precision +# ./measure-startup.ps1 -SkipBuild # Skip rebuild if already built +# ./measure-startup.ps1 -Filter "/*/*/SimpleTests_01/*" # Filtered run + +param( + [int]$Iterations = 3, + [switch]$SkipBuild, + [string]$Filter = "/*/*/*/*", + [string]$Configuration = "Release", + [switch]$IncludeJitStats +) + +$ErrorActionPreference = "Stop" +$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path +$projectDir = $scriptDir +$projectFile = Join-Path $projectDir "TUnit.PerformanceBenchmarks.csproj" +$resultsDir = Join-Path $projectDir "benchmark-results" + +# Ensure results directory exists +New-Item -ItemType Directory -Force -Path $resultsDir | Out-Null + +$timestamp = Get-Date -Format "yyyy-MM-dd_HH-mm-ss" +$resultsFile = Join-Path $resultsDir "startup-$timestamp.json" + +Write-Host "============================================" -ForegroundColor Cyan +Write-Host " TUnit Startup Performance Measurement" -ForegroundColor Cyan +Write-Host "============================================" -ForegroundColor Cyan +Write-Host "" +Write-Host "Config: $Configuration" +Write-Host "Iterations: $Iterations" +Write-Host "Filter: $Filter" +Write-Host "JIT Stats: $IncludeJitStats" +Write-Host "" + +# Step 1: Build +if (-not $SkipBuild) { + Write-Host "[1/3] Building $Configuration..." -ForegroundColor Yellow + $buildSw = [System.Diagnostics.Stopwatch]::StartNew() + dotnet build $projectFile -c $Configuration --no-incremental -v q 2>&1 | Out-Null + if ($LASTEXITCODE -ne 0) { + Write-Host "Build failed!" -ForegroundColor Red + exit 1 + } + $buildSw.Stop() + Write-Host " Build completed in $($buildSw.Elapsed.TotalSeconds.ToString('F1'))s" -ForegroundColor Green +} else { + Write-Host "[1/3] Skipping build (--SkipBuild)" -ForegroundColor DarkGray +} + +# Step 2: Find the built executable +$tfm = "net9.0" +$exeDir = Join-Path $projectDir "bin" $Configuration $tfm +$exeName = "TUnit.PerformanceBenchmarks" +if ($IsWindows -or $env:OS -match "Windows") { + $exePath = Join-Path $exeDir "$exeName.exe" +} else { + $exePath = Join-Path $exeDir $exeName +} + +if (-not (Test-Path $exePath)) { + # Fall back to dotnet run + Write-Host " Executable not found at $exePath, falling back to dotnet run" -ForegroundColor DarkYellow + $useDotnetRun = $true +} else { + $useDotnetRun = $false + Write-Host " Using pre-built exe: $exePath" -ForegroundColor Green +} + +# Step 3: Run measurements +Write-Host "" +Write-Host "[2/3] Running $Iterations iterations..." -ForegroundColor Yellow + +$results = @() + +for ($i = 1; $i -le $Iterations; $i++) { + Write-Host " Iteration $i/$Iterations... " -NoNewline + + # Force GC before each run to reduce noise + [GC]::Collect() + [GC]::WaitForPendingFinalizers() + [GC]::Collect() + + $sw = [System.Diagnostics.Stopwatch]::StartNew() + + if ($useDotnetRun) { + $output = dotnet run --project $projectFile -c $Configuration --no-build -- --treenode-filter "$Filter" --report-trx --timeout 120 2>&1 + } else { + $output = & $exePath --treenode-filter "$Filter" --report-trx --timeout 120 2>&1 + } + + $sw.Stop() + $exitCode = $LASTEXITCODE + $wallTimeMs = $sw.Elapsed.TotalMilliseconds + + # Parse test count from output + $testCount = 0 + $passedCount = 0 + $failedCount = 0 + foreach ($line in $output) { + if ($line -match "Passed:\s*(\d+)") { $passedCount = [int]$Matches[1] } + if ($line -match "Failed:\s*(\d+)") { $failedCount = [int]$Matches[1] } + if ($line -match "Total:\s*(\d+)") { $testCount = [int]$Matches[1] } + } + + $result = @{ + Iteration = $i + WallTimeMs = [math]::Round($wallTimeMs, 1) + TestCount = $testCount + Passed = $passedCount + Failed = $failedCount + ExitCode = $exitCode + } + $results += $result + + $statusColor = if ($exitCode -eq 0) { "Green" } else { "Yellow" } + Write-Host "$($wallTimeMs.ToString('F0'))ms ($testCount tests)" -ForegroundColor $statusColor +} + +# Step 4: Calculate statistics +Write-Host "" +Write-Host "[3/3] Results" -ForegroundColor Yellow +Write-Host "" + +$times = $results | ForEach-Object { $_.WallTimeMs } +$avg = ($times | Measure-Object -Average).Average +$min = ($times | Measure-Object -Minimum).Minimum +$max = ($times | Measure-Object -Maximum).Maximum +$sorted = $times | Sort-Object +$median = if ($sorted.Count % 2 -eq 0) { + ($sorted[$sorted.Count/2 - 1] + $sorted[$sorted.Count/2]) / 2 +} else { + $sorted[[math]::Floor($sorted.Count/2)] +} + +# Standard deviation +$sumSquares = 0 +foreach ($t in $times) { $sumSquares += ($t - $avg) * ($t - $avg) } +$stddev = [math]::Sqrt($sumSquares / $times.Count) + +Write-Host " Wall-Clock Time:" -ForegroundColor Cyan +Write-Host " Median: $($median.ToString('F0'))ms" +Write-Host " Average: $($avg.ToString('F0'))ms" +Write-Host " Min: $($min.ToString('F0'))ms" +Write-Host " Max: $($max.ToString('F0'))ms" +Write-Host " StdDev: $($stddev.ToString('F0'))ms" +Write-Host "" +Write-Host " Tests: $($results[0].TestCount) discovered" -ForegroundColor Cyan +Write-Host "" + +# Save results +$report = @{ + Timestamp = $timestamp + Configuration = $Configuration + Filter = $Filter + Iterations = $Iterations + TestCount = $results[0].TestCount + Summary = @{ + MedianMs = [math]::Round($median, 1) + AverageMs = [math]::Round($avg, 1) + MinMs = [math]::Round($min, 1) + MaxMs = [math]::Round($max, 1) + StdDevMs = [math]::Round($stddev, 1) + } + Runs = $results + Environment = @{ + DotnetVersion = (dotnet --version 2>$null) ?? "unknown" + OS = [System.Runtime.InteropServices.RuntimeInformation]::OSDescription + ProcessorCount = [Environment]::ProcessorCount + MachineName = [Environment]::MachineName + } +} + +$report | ConvertTo-Json -Depth 5 | Out-File -FilePath $resultsFile -Encoding utf8 +Write-Host " Results saved to: $resultsFile" -ForegroundColor DarkGray 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 99916e3fa2..6196d9fa8f 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 @@ -902,6 +902,14 @@ namespace ScopeType { get; } } public interface ITestDefinition { } + public interface ITestEntrySource + { + string ClassName { get; } + ClassType { get; } + int Count { get; } + .TestEntryFilterData GetFilterData(int index); + .<.TestMetadata> Materialize(int index, string testSessionId); + } public interface ITypedDataSourceAttribute : .IDataSourceAttribute { .<<.>> GetTypedDataRowsAsync(.DataGeneratorMetadata dataGeneratorMetadata); @@ -911,6 +919,14 @@ namespace { public InheritsTestsAttribute() { } } + public sealed class InjectableProperty + { + public InjectableProperty() { } + public required .IDataSourceAttribute DataSource { get; init; } + public required string Name { get; init; } + public required SetValue { get; init; } + public required Type { get; init; } + } [(.Method | .Property, AllowMultiple=true)] public class InstanceMethodDataSourceAttribute : .MethodDataSourceAttribute, .IAccessesInstanceData { @@ -1262,18 +1278,15 @@ namespace { public SourceRegistrar() { } public static bool IsEnabled { get; set; } - public static void Register(..ITestSource testSource) { } - public static void Register( testClassType, ..ITestSource testSource) { } - public static void Register( testClassType, > getTests, <.<.TestDescriptor>> enumerateDescriptors) { } public static void RegisterAssembly(<.Assembly> assemblyLoader) { } public static void RegisterDynamic(.IDynamicTestSource testSource) { } + public static int RegisterEntries<[.(..None | ..PublicParameterlessConstructor | ..PublicConstructors | ..PublicMethods | ..PublicProperties)] T>(.TestEntry[] entries) + where T : class { } public static void RegisterGlobalInitializer(<.> initializer) { } public static int RegisterHook(. bag, T hook) { } public static int RegisterHook(.<.Assembly, .> dictionary, .Assembly key, T hook) { } public static int RegisterHook(.<, .> dictionary, key, T hook) { } public static void RegisterProperty(..IPropertySource propertySource) { } - public static int RegisterReturn( testClassType, ..ITestSource testSource) { } - public static int RegisterReturn( testClassType, > getTests, <.<.TestDescriptor>> enumerateDescriptors) { } } public static class Sources { @@ -1297,7 +1310,7 @@ namespace public static readonly .<.IDynamicTestSource> DynamicTestSources; public static readonly .<<.>> GlobalInitializers; public static readonly .<..IPropertySource> PropertySources; - public static readonly .<, .<..ITestSource>> TestSources; + public static readonly .<, .ITestEntrySource> TestEntries; } [.("Reflection mode requires dynamic access for static property initialization")] public static class StaticPropertyReflectionInitializer @@ -1443,24 +1456,6 @@ namespace public static .TestDependency FromClassAndMethod( classType, string methodName, bool proceedOnFailure = false) { } public static .TestDependency FromMethodName(string methodName, bool proceedOnFailure = false) { } } - public readonly struct TestDescriptor - { - public TestDescriptor() { } - public string[] Categories { get; init; } - public required string ClassName { get; init; } - public string[] DependsOn { get; init; } - public required string FilePath { get; init; } - public required string FullyQualifiedName { get; init; } - public bool HasDataSource { get; init; } - public required int LineNumber { get; init; } - public required > Materializer { get; init; } - public required string MethodName { get; init; } - public string[] Properties { get; init; } - public int RepeatCount { get; init; } - public required string TestId { get; init; } - public bool HasCategory(string category) { } - public bool HasProperty(string key, string? value = null) { } - } public class TestDetails : ., ., ., ., ., . { public TestDetails(.<> allAttributes) { } @@ -1514,6 +1509,50 @@ namespace public new static .TestDiscoveryContext? Current { get; } public void AddTests(.<.TestContext> tests) { } } + public readonly struct TestEntryFilterData + { + public required string[] Categories { get; init; } + public required string ClassName { get; init; } + public required string[] DependsOn { get; init; } + public required bool HasDataSource { get; init; } + public required string MethodName { get; init; } + public required string[] Properties { get; init; } + public required int RepeatCount { get; init; } + } + public sealed class TestEntrySource<[.(..None | ..PublicParameterlessConstructor | ..PublicConstructors | ..PublicMethods | ..PublicProperties)] T> : .ITestEntrySource + where T : class + { + public TestEntrySource(.TestEntry[] entries) { } + public string ClassName { get; } + public ClassType { get; } + public int Count { get; } + public .TestEntryFilterData GetFilterData(int index) { } + public .<.TestMetadata> Materialize(int index, string testSessionId) { } + } + public sealed class TestEntry<[.(..None | ..PublicParameterlessConstructor | ..PublicConstructors | ..PublicMethods | ..PublicProperties)] T> + where T : class + { + public TestEntry() { } + public required int AttributeGroupIndex { get; init; } + public string[] Categories { get; init; } + public .IDataSourceAttribute[] ClassDataSources { get; init; } + public required CreateAttributes { get; init; } + public required <[], object?[], T> CreateInstance { get; init; } + public .TestDependency[] Dependencies { get; init; } + public string[] DependsOn { get; init; } + public required string FilePath { get; init; } + public required string FullyQualifiedName { get; init; } + public bool HasDataSource { get; init; } + public .InjectableProperty[] InjectableProperties { get; init; } + public required InvokeBody { get; init; } + public required int LineNumber { get; init; } + public required int MethodIndex { get; init; } + public required .MethodMetadata MethodMetadata { get; init; } + public required string MethodName { get; init; } + public string[] Properties { get; init; } + public int RepeatCount { get; init; } + public .IDataSourceAttribute[] TestDataSources { get; init; } + } public class TestInstantiationException : .TestBuilderException { public TestInstantiationException( testClassType, innerException) { } @@ -2656,14 +2695,6 @@ namespace . Type { get; } .<..PropertyInjectionMetadata> GetPropertyMetadata(); } - public interface ITestDescriptorSource - { - .<.TestDescriptor> EnumerateTestDescriptors(); - } - public interface ITestSource - { - .<.TestMetadata> GetTests(string testSessionId); - } public sealed class PropertyInjectionMetadata { public PropertyInjectionMetadata() { } 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 f55f320422..b36057a79f 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 @@ -902,6 +902,14 @@ namespace ScopeType { get; } } public interface ITestDefinition { } + public interface ITestEntrySource + { + string ClassName { get; } + ClassType { get; } + int Count { get; } + .TestEntryFilterData GetFilterData(int index); + .<.TestMetadata> Materialize(int index, string testSessionId); + } public interface ITypedDataSourceAttribute : .IDataSourceAttribute { .<<.>> GetTypedDataRowsAsync(.DataGeneratorMetadata dataGeneratorMetadata); @@ -911,6 +919,14 @@ namespace { public InheritsTestsAttribute() { } } + public sealed class InjectableProperty + { + public InjectableProperty() { } + public required .IDataSourceAttribute DataSource { get; init; } + public required string Name { get; init; } + public required SetValue { get; init; } + public required Type { get; init; } + } [(.Method | .Property, AllowMultiple=true)] public class InstanceMethodDataSourceAttribute : .MethodDataSourceAttribute, .IAccessesInstanceData { @@ -1262,18 +1278,15 @@ namespace { public SourceRegistrar() { } public static bool IsEnabled { get; set; } - public static void Register(..ITestSource testSource) { } - public static void Register( testClassType, ..ITestSource testSource) { } - public static void Register( testClassType, > getTests, <.<.TestDescriptor>> enumerateDescriptors) { } public static void RegisterAssembly(<.Assembly> assemblyLoader) { } public static void RegisterDynamic(.IDynamicTestSource testSource) { } + public static int RegisterEntries<[.(..None | ..PublicParameterlessConstructor | ..PublicConstructors | ..PublicMethods | ..PublicProperties)] T>(.TestEntry[] entries) + where T : class { } public static void RegisterGlobalInitializer(<.> initializer) { } public static int RegisterHook(. bag, T hook) { } public static int RegisterHook(.<.Assembly, .> dictionary, .Assembly key, T hook) { } public static int RegisterHook(.<, .> dictionary, key, T hook) { } public static void RegisterProperty(..IPropertySource propertySource) { } - public static int RegisterReturn( testClassType, ..ITestSource testSource) { } - public static int RegisterReturn( testClassType, > getTests, <.<.TestDescriptor>> enumerateDescriptors) { } } public static class Sources { @@ -1297,7 +1310,7 @@ namespace public static readonly .<.IDynamicTestSource> DynamicTestSources; public static readonly .<<.>> GlobalInitializers; public static readonly .<..IPropertySource> PropertySources; - public static readonly .<, .<..ITestSource>> TestSources; + public static readonly .<, .ITestEntrySource> TestEntries; } [.("Reflection mode requires dynamic access for static property initialization")] public static class StaticPropertyReflectionInitializer @@ -1443,24 +1456,6 @@ namespace public static .TestDependency FromClassAndMethod( classType, string methodName, bool proceedOnFailure = false) { } public static .TestDependency FromMethodName(string methodName, bool proceedOnFailure = false) { } } - public readonly struct TestDescriptor - { - public TestDescriptor() { } - public string[] Categories { get; init; } - public required string ClassName { get; init; } - public string[] DependsOn { get; init; } - public required string FilePath { get; init; } - public required string FullyQualifiedName { get; init; } - public bool HasDataSource { get; init; } - public required int LineNumber { get; init; } - public required > Materializer { get; init; } - public required string MethodName { get; init; } - public string[] Properties { get; init; } - public int RepeatCount { get; init; } - public required string TestId { get; init; } - public bool HasCategory(string category) { } - public bool HasProperty(string key, string? value = null) { } - } public class TestDetails : ., ., ., ., ., . { public TestDetails(.<> allAttributes) { } @@ -1514,6 +1509,50 @@ namespace public new static .TestDiscoveryContext? Current { get; } public void AddTests(.<.TestContext> tests) { } } + public readonly struct TestEntryFilterData + { + public required string[] Categories { get; init; } + public required string ClassName { get; init; } + public required string[] DependsOn { get; init; } + public required bool HasDataSource { get; init; } + public required string MethodName { get; init; } + public required string[] Properties { get; init; } + public required int RepeatCount { get; init; } + } + public sealed class TestEntrySource<[.(..None | ..PublicParameterlessConstructor | ..PublicConstructors | ..PublicMethods | ..PublicProperties)] T> : .ITestEntrySource + where T : class + { + public TestEntrySource(.TestEntry[] entries) { } + public string ClassName { get; } + public ClassType { get; } + public int Count { get; } + public .TestEntryFilterData GetFilterData(int index) { } + public .<.TestMetadata> Materialize(int index, string testSessionId) { } + } + public sealed class TestEntry<[.(..None | ..PublicParameterlessConstructor | ..PublicConstructors | ..PublicMethods | ..PublicProperties)] T> + where T : class + { + public TestEntry() { } + public required int AttributeGroupIndex { get; init; } + public string[] Categories { get; init; } + public .IDataSourceAttribute[] ClassDataSources { get; init; } + public required CreateAttributes { get; init; } + public required <[], object?[], T> CreateInstance { get; init; } + public .TestDependency[] Dependencies { get; init; } + public string[] DependsOn { get; init; } + public required string FilePath { get; init; } + public required string FullyQualifiedName { get; init; } + public bool HasDataSource { get; init; } + public .InjectableProperty[] InjectableProperties { get; init; } + public required InvokeBody { get; init; } + public required int LineNumber { get; init; } + public required int MethodIndex { get; init; } + public required .MethodMetadata MethodMetadata { get; init; } + public required string MethodName { get; init; } + public string[] Properties { get; init; } + public int RepeatCount { get; init; } + public .IDataSourceAttribute[] TestDataSources { get; init; } + } public class TestInstantiationException : .TestBuilderException { public TestInstantiationException( testClassType, innerException) { } @@ -2656,14 +2695,6 @@ namespace . Type { get; } .<..PropertyInjectionMetadata> GetPropertyMetadata(); } - public interface ITestDescriptorSource - { - .<.TestDescriptor> EnumerateTestDescriptors(); - } - public interface ITestSource - { - .<.TestMetadata> GetTests(string testSessionId); - } public sealed class PropertyInjectionMetadata { public PropertyInjectionMetadata() { } 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 5f6d466f55..6b57b8bafb 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 @@ -902,6 +902,14 @@ namespace ScopeType { get; } } public interface ITestDefinition { } + public interface ITestEntrySource + { + string ClassName { get; } + ClassType { get; } + int Count { get; } + .TestEntryFilterData GetFilterData(int index); + .<.TestMetadata> Materialize(int index, string testSessionId); + } public interface ITypedDataSourceAttribute : .IDataSourceAttribute { .<<.>> GetTypedDataRowsAsync(.DataGeneratorMetadata dataGeneratorMetadata); @@ -911,6 +919,14 @@ namespace { public InheritsTestsAttribute() { } } + public sealed class InjectableProperty + { + public InjectableProperty() { } + public required .IDataSourceAttribute DataSource { get; init; } + public required string Name { get; init; } + public required SetValue { get; init; } + public required Type { get; init; } + } [(.Method | .Property, AllowMultiple=true)] public class InstanceMethodDataSourceAttribute : .MethodDataSourceAttribute, .IAccessesInstanceData { @@ -1262,18 +1278,15 @@ namespace { public SourceRegistrar() { } public static bool IsEnabled { get; set; } - public static void Register(..ITestSource testSource) { } - public static void Register( testClassType, ..ITestSource testSource) { } - public static void Register( testClassType, > getTests, <.<.TestDescriptor>> enumerateDescriptors) { } public static void RegisterAssembly(<.Assembly> assemblyLoader) { } public static void RegisterDynamic(.IDynamicTestSource testSource) { } + public static int RegisterEntries<[.(..None | ..PublicParameterlessConstructor | ..PublicConstructors | ..PublicMethods | ..PublicProperties)] T>(.TestEntry[] entries) + where T : class { } public static void RegisterGlobalInitializer(<.> initializer) { } public static int RegisterHook(. bag, T hook) { } public static int RegisterHook(.<.Assembly, .> dictionary, .Assembly key, T hook) { } public static int RegisterHook(.<, .> dictionary, key, T hook) { } public static void RegisterProperty(..IPropertySource propertySource) { } - public static int RegisterReturn( testClassType, ..ITestSource testSource) { } - public static int RegisterReturn( testClassType, > getTests, <.<.TestDescriptor>> enumerateDescriptors) { } } public static class Sources { @@ -1297,7 +1310,7 @@ namespace public static readonly .<.IDynamicTestSource> DynamicTestSources; public static readonly .<<.>> GlobalInitializers; public static readonly .<..IPropertySource> PropertySources; - public static readonly .<, .<..ITestSource>> TestSources; + public static readonly .<, .ITestEntrySource> TestEntries; } [.("Reflection mode requires dynamic access for static property initialization")] public static class StaticPropertyReflectionInitializer @@ -1443,24 +1456,6 @@ namespace public static .TestDependency FromClassAndMethod( classType, string methodName, bool proceedOnFailure = false) { } public static .TestDependency FromMethodName(string methodName, bool proceedOnFailure = false) { } } - public readonly struct TestDescriptor - { - public TestDescriptor() { } - public string[] Categories { get; init; } - public required string ClassName { get; init; } - public string[] DependsOn { get; init; } - public required string FilePath { get; init; } - public required string FullyQualifiedName { get; init; } - public bool HasDataSource { get; init; } - public required int LineNumber { get; init; } - public required > Materializer { get; init; } - public required string MethodName { get; init; } - public string[] Properties { get; init; } - public int RepeatCount { get; init; } - public required string TestId { get; init; } - public bool HasCategory(string category) { } - public bool HasProperty(string key, string? value = null) { } - } public class TestDetails : ., ., ., ., ., . { public TestDetails(.<> allAttributes) { } @@ -1514,6 +1509,50 @@ namespace public new static .TestDiscoveryContext? Current { get; } public void AddTests(.<.TestContext> tests) { } } + public readonly struct TestEntryFilterData + { + public required string[] Categories { get; init; } + public required string ClassName { get; init; } + public required string[] DependsOn { get; init; } + public required bool HasDataSource { get; init; } + public required string MethodName { get; init; } + public required string[] Properties { get; init; } + public required int RepeatCount { get; init; } + } + public sealed class TestEntrySource<[.(..None | ..PublicParameterlessConstructor | ..PublicConstructors | ..PublicMethods | ..PublicProperties)] T> : .ITestEntrySource + where T : class + { + public TestEntrySource(.TestEntry[] entries) { } + public string ClassName { get; } + public ClassType { get; } + public int Count { get; } + public .TestEntryFilterData GetFilterData(int index) { } + public .<.TestMetadata> Materialize(int index, string testSessionId) { } + } + public sealed class TestEntry<[.(..None | ..PublicParameterlessConstructor | ..PublicConstructors | ..PublicMethods | ..PublicProperties)] T> + where T : class + { + public TestEntry() { } + public required int AttributeGroupIndex { get; init; } + public string[] Categories { get; init; } + public .IDataSourceAttribute[] ClassDataSources { get; init; } + public required CreateAttributes { get; init; } + public required <[], object?[], T> CreateInstance { get; init; } + public .TestDependency[] Dependencies { get; init; } + public string[] DependsOn { get; init; } + public required string FilePath { get; init; } + public required string FullyQualifiedName { get; init; } + public bool HasDataSource { get; init; } + public .InjectableProperty[] InjectableProperties { get; init; } + public required InvokeBody { get; init; } + public required int LineNumber { get; init; } + public required int MethodIndex { get; init; } + public required .MethodMetadata MethodMetadata { get; init; } + public required string MethodName { get; init; } + public string[] Properties { get; init; } + public int RepeatCount { get; init; } + public .IDataSourceAttribute[] TestDataSources { get; init; } + } public class TestInstantiationException : .TestBuilderException { public TestInstantiationException( testClassType, innerException) { } @@ -2656,14 +2695,6 @@ namespace . Type { get; } .<..PropertyInjectionMetadata> GetPropertyMetadata(); } - public interface ITestDescriptorSource - { - .<.TestDescriptor> EnumerateTestDescriptors(); - } - public interface ITestSource - { - .<.TestMetadata> GetTests(string testSessionId); - } public sealed class PropertyInjectionMetadata { public PropertyInjectionMetadata() { } diff --git a/TUnit.PublicAPI/Tests.Core_Library_Has_No_API_Changes.Net4_7.verified.txt b/TUnit.PublicAPI/Tests.Core_Library_Has_No_API_Changes.Net4_7.verified.txt index 47351a6128..72f7412936 100644 --- a/TUnit.PublicAPI/Tests.Core_Library_Has_No_API_Changes.Net4_7.verified.txt +++ b/TUnit.PublicAPI/Tests.Core_Library_Has_No_API_Changes.Net4_7.verified.txt @@ -878,6 +878,14 @@ namespace ScopeType { get; } } public interface ITestDefinition { } + public interface ITestEntrySource + { + string ClassName { get; } + ClassType { get; } + int Count { get; } + .TestEntryFilterData GetFilterData(int index); + .<.TestMetadata> Materialize(int index, string testSessionId); + } public interface ITypedDataSourceAttribute : .IDataSourceAttribute { .<<.>> GetTypedDataRowsAsync(.DataGeneratorMetadata dataGeneratorMetadata); @@ -887,6 +895,14 @@ namespace { public InheritsTestsAttribute() { } } + public sealed class InjectableProperty + { + public InjectableProperty() { } + public required .IDataSourceAttribute DataSource { get; init; } + public required string Name { get; init; } + public required SetValue { get; init; } + public required Type { get; init; } + } [(.Method | .Property, AllowMultiple=true)] public class InstanceMethodDataSourceAttribute : .MethodDataSourceAttribute, .IAccessesInstanceData { @@ -1217,18 +1233,15 @@ namespace { public SourceRegistrar() { } public static bool IsEnabled { get; set; } - public static void Register(..ITestSource testSource) { } - public static void Register( testClassType, ..ITestSource testSource) { } - public static void Register( testClassType, > getTests, <.<.TestDescriptor>> enumerateDescriptors) { } public static void RegisterAssembly(<.Assembly> assemblyLoader) { } public static void RegisterDynamic(.IDynamicTestSource testSource) { } + public static int RegisterEntries(.TestEntry[] entries) + where T : class { } public static void RegisterGlobalInitializer(<.> initializer) { } public static int RegisterHook(. bag, T hook) { } public static int RegisterHook(.<.Assembly, .> dictionary, .Assembly key, T hook) { } public static int RegisterHook(.<, .> dictionary, key, T hook) { } public static void RegisterProperty(..IPropertySource propertySource) { } - public static int RegisterReturn( testClassType, ..ITestSource testSource) { } - public static int RegisterReturn( testClassType, > getTests, <.<.TestDescriptor>> enumerateDescriptors) { } } public static class Sources { @@ -1252,7 +1265,7 @@ namespace public static readonly .<.IDynamicTestSource> DynamicTestSources; public static readonly .<<.>> GlobalInitializers; public static readonly .<..IPropertySource> PropertySources; - public static readonly .<, .<..ITestSource>> TestSources; + public static readonly .<, .ITestEntrySource> TestEntries; } public static class StaticPropertyReflectionInitializer { @@ -1393,24 +1406,6 @@ namespace public static .TestDependency FromClassAndMethod( classType, string methodName, bool proceedOnFailure = false) { } public static .TestDependency FromMethodName(string methodName, bool proceedOnFailure = false) { } } - public readonly struct TestDescriptor - { - public TestDescriptor() { } - public string[] Categories { get; init; } - public required string ClassName { get; init; } - public string[] DependsOn { get; init; } - public required string FilePath { get; init; } - public required string FullyQualifiedName { get; init; } - public bool HasDataSource { get; init; } - public required int LineNumber { get; init; } - public required > Materializer { get; init; } - public required string MethodName { get; init; } - public string[] Properties { get; init; } - public int RepeatCount { get; init; } - public required string TestId { get; init; } - public bool HasCategory(string category) { } - public bool HasProperty(string key, string? value = null) { } - } public class TestDetails : ., ., ., ., ., . { public TestDetails(.<> allAttributes) { } @@ -1463,6 +1458,50 @@ namespace public new static .TestDiscoveryContext? Current { get; } public void AddTests(.<.TestContext> tests) { } } + public readonly struct TestEntryFilterData + { + public required string[] Categories { get; init; } + public required string ClassName { get; init; } + public required string[] DependsOn { get; init; } + public required bool HasDataSource { get; init; } + public required string MethodName { get; init; } + public required string[] Properties { get; init; } + public required int RepeatCount { get; init; } + } + public sealed class TestEntrySource : .ITestEntrySource + where T : class + { + public TestEntrySource(.TestEntry[] entries) { } + public string ClassName { get; } + public ClassType { get; } + public int Count { get; } + public .TestEntryFilterData GetFilterData(int index) { } + public .<.TestMetadata> Materialize(int index, string testSessionId) { } + } + public sealed class TestEntry + where T : class + { + public TestEntry() { } + public required int AttributeGroupIndex { get; init; } + public string[] Categories { get; init; } + public .IDataSourceAttribute[] ClassDataSources { get; init; } + public required CreateAttributes { get; init; } + public required <[], object?[], T> CreateInstance { get; init; } + public .TestDependency[] Dependencies { get; init; } + public string[] DependsOn { get; init; } + public required string FilePath { get; init; } + public required string FullyQualifiedName { get; init; } + public bool HasDataSource { get; init; } + public .InjectableProperty[] InjectableProperties { get; init; } + public required InvokeBody { get; init; } + public required int LineNumber { get; init; } + public required int MethodIndex { get; init; } + public required .MethodMetadata MethodMetadata { get; init; } + public required string MethodName { get; init; } + public string[] Properties { get; init; } + public int RepeatCount { get; init; } + public .IDataSourceAttribute[] TestDataSources { get; init; } + } public class TestInstantiationException : .TestBuilderException { public TestInstantiationException( testClassType, innerException) { } @@ -2594,14 +2633,6 @@ namespace . Type { get; } .<..PropertyInjectionMetadata> GetPropertyMetadata(); } - public interface ITestDescriptorSource - { - .<.TestDescriptor> EnumerateTestDescriptors(); - } - public interface ITestSource - { - .<.TestMetadata> GetTests(string testSessionId); - } public sealed class PropertyInjectionMetadata { public PropertyInjectionMetadata() { }