diff --git a/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete2.verified.txt b/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete2.verified.txt index 12c928eb63e..c7e2e2fb8f4 100644 --- a/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete2.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete2.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_SecondTest = new global::TUnit.Core.TestMetadata { TestName = "SecondTest", TestClassType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), TestMethodName = "SecondTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -44,11 +44,11 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_ Parent = null }) }, - InstanceFactory = TUnit_TestProject_AbstractTests_ConcreteClass2__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SecondTest, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_SecondTest.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_SecondTest }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -65,10 +65,10 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_ HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_SecondTest }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -77,7 +77,7 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_ new global::TUnit.Core.InheritsTestsAttribute() ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AbstractTests.ConcreteClass2 instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_SecondTest(global::TUnit.TestProject.AbstractTests.ConcreteClass2 instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -89,20 +89,49 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_ return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_AbstractTests_ConcreteClass2__ClassHelper -{ + private static global::System.Collections.Generic.IReadOnlyList __Materialize_SecondTest(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "SecondTest", + TestClassType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), + TestMethodName = "SecondTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 11, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2)), + Name = "SecondTest", + 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.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_SecondTest, + }; + metadata.UseRuntimeDataGeneration(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(); @@ -110,7 +139,7 @@ internal static class TUnit_TestProject_AbstractTests_ConcreteClass2__ClassHelpe [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), new TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), new TUnit_TestProject_AbstractTests_ConcreteClass2__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/AfterAllTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/AfterAllTests.Test.verified.txt index 483436fd31e..c269edf5a28 100644 --- a/TUnit.Core.SourceGenerator.Tests/AfterAllTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AfterAllTests.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_AfterTests_CleanupTests_Test1_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_AfterTests_CleanupTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_Test1 = new global::TUnit.Core.TestMetadata { TestName = "Test1", TestClassType = typeof(global::TUnit.TestProject.AfterTests.CleanupTests), TestMethodName = "Test1", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -44,11 +44,50 @@ internal sealed class TUnit_TestProject_AfterTests_CleanupTests_Test1_TestSource Parent = null }) }, - InstanceFactory = TUnit_TestProject_AfterTests_CleanupTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test1, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_Test1.UseRuntimeDataGeneration(testSessionId); + var metadata_Test2 = new global::TUnit.Core.TestMetadata + { + TestName = "Test2", + TestClassType = typeof(global::TUnit.TestProject.AfterTests.CleanupTests), + TestMethodName = "Test2", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 104, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.AfterTests.CleanupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.CleanupTests)), + Name = "Test2", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test2, + }; + metadata_Test2.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_Test1, metadata_Test2 }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -65,17 +104,32 @@ internal sealed class TUnit_TestProject_AfterTests_CleanupTests_Test1_TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_Test1 + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.AfterTests.CleanupTests.Test2", + ClassName = "CleanupTests", + MethodName = "Test2", + FullyQualifiedName = "TUnit.TestProject.AfterTests.CleanupTests.Test2", + FilePath = @"", + LineNumber = 104, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Test2 }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ new global::TUnit.Core.TestAttribute() ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AfterTests.CleanupTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_Test1(global::TUnit.TestProject.AfterTests.CleanupTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -86,41 +140,38 @@ internal sealed class TUnit_TestProject_AfterTests_CleanupTests_Test1_TestSource return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_AfterTests_CleanupTests_Test2_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata { - TestName = "Test2", + TestName = "Test1", TestClassType = typeof(global::TUnit.TestProject.AfterTests.CleanupTests), - TestMethodName = "Test2", + TestMethodName = "Test1", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 104, + LineNumber = 98, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.AfterTests.CleanupTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.CleanupTests)), - Name = "Test2", + Name = "Test1", GenericTypeCount = 0, ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), @@ -137,62 +188,55 @@ internal sealed class TUnit_TestProject_AfterTests_CleanupTests_Test2_TestSource Parent = null }) }, - InstanceFactory = TUnit_TestProject_AfterTests_CleanupTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test1, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test2(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.AfterTests.CleanupTests.Test2", - ClassName = "CleanupTests", - MethodName = "Test2", - FullyQualifiedName = "TUnit.TestProject.AfterTests.CleanupTests.Test2", + TestName = "Test2", + TestClassType = typeof(global::TUnit.TestProject.AfterTests.CleanupTests), + TestMethodName = "Test2", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", LineNumber = 104, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.AfterTests.CleanupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.CleanupTests)), + Name = "Test2", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test2, }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AfterTests.CleanupTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.Test2()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_AfterTests_CleanupTests__ClassHelper -{ internal static global::TUnit.TestProject.AfterTests.CleanupTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.AfterTests.CleanupTests(); @@ -200,7 +244,6 @@ internal static class TUnit_TestProject_AfterTests_CleanupTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AfterTests.CleanupTests), new TUnit_TestProject_AfterTests_CleanupTests_Test1_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AfterTests.CleanupTests), new TUnit_TestProject_AfterTests_CleanupTests_Test2_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AfterTests.CleanupTests), new TUnit_TestProject_AfterTests_CleanupTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/AfterTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/AfterTests.Test.verified.txt index 483436fd31e..c269edf5a28 100644 --- a/TUnit.Core.SourceGenerator.Tests/AfterTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AfterTests.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_AfterTests_CleanupTests_Test1_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_AfterTests_CleanupTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_Test1 = new global::TUnit.Core.TestMetadata { TestName = "Test1", TestClassType = typeof(global::TUnit.TestProject.AfterTests.CleanupTests), TestMethodName = "Test1", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -44,11 +44,50 @@ internal sealed class TUnit_TestProject_AfterTests_CleanupTests_Test1_TestSource Parent = null }) }, - InstanceFactory = TUnit_TestProject_AfterTests_CleanupTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test1, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_Test1.UseRuntimeDataGeneration(testSessionId); + var metadata_Test2 = new global::TUnit.Core.TestMetadata + { + TestName = "Test2", + TestClassType = typeof(global::TUnit.TestProject.AfterTests.CleanupTests), + TestMethodName = "Test2", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 104, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.AfterTests.CleanupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.CleanupTests)), + Name = "Test2", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test2, + }; + metadata_Test2.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_Test1, metadata_Test2 }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -65,17 +104,32 @@ internal sealed class TUnit_TestProject_AfterTests_CleanupTests_Test1_TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_Test1 + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.AfterTests.CleanupTests.Test2", + ClassName = "CleanupTests", + MethodName = "Test2", + FullyQualifiedName = "TUnit.TestProject.AfterTests.CleanupTests.Test2", + FilePath = @"", + LineNumber = 104, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Test2 }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ new global::TUnit.Core.TestAttribute() ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AfterTests.CleanupTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_Test1(global::TUnit.TestProject.AfterTests.CleanupTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -86,41 +140,38 @@ internal sealed class TUnit_TestProject_AfterTests_CleanupTests_Test1_TestSource return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_AfterTests_CleanupTests_Test2_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata { - TestName = "Test2", + TestName = "Test1", TestClassType = typeof(global::TUnit.TestProject.AfterTests.CleanupTests), - TestMethodName = "Test2", + TestMethodName = "Test1", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 104, + LineNumber = 98, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.AfterTests.CleanupTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.CleanupTests)), - Name = "Test2", + Name = "Test1", GenericTypeCount = 0, ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), @@ -137,62 +188,55 @@ internal sealed class TUnit_TestProject_AfterTests_CleanupTests_Test2_TestSource Parent = null }) }, - InstanceFactory = TUnit_TestProject_AfterTests_CleanupTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test1, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test2(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.AfterTests.CleanupTests.Test2", - ClassName = "CleanupTests", - MethodName = "Test2", - FullyQualifiedName = "TUnit.TestProject.AfterTests.CleanupTests.Test2", + TestName = "Test2", + TestClassType = typeof(global::TUnit.TestProject.AfterTests.CleanupTests), + TestMethodName = "Test2", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", LineNumber = 104, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.AfterTests.CleanupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AfterTests.CleanupTests)), + Name = "Test2", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test2, }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AfterTests.CleanupTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.Test2()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_AfterTests_CleanupTests__ClassHelper -{ internal static global::TUnit.TestProject.AfterTests.CleanupTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.AfterTests.CleanupTests(); @@ -200,7 +244,6 @@ internal static class TUnit_TestProject_AfterTests_CleanupTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AfterTests.CleanupTests), new TUnit_TestProject_AfterTests_CleanupTests_Test1_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AfterTests.CleanupTests), new TUnit_TestProject_AfterTests_CleanupTests_Test2_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AfterTests.CleanupTests), new TUnit_TestProject_AfterTests_CleanupTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/ArgsAsArrayTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ArgsAsArrayTests.Test.verified.txt index 4ccbb25f458..1dcde314313 100644 --- a/TUnit.Core.SourceGenerator.Tests/ArgsAsArrayTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ArgsAsArrayTests.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_ArgsAsArrayTests_Params__string___TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_ArgsAsArrayTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_Params__string__ = new global::TUnit.Core.TestMetadata { TestName = "Params", TestClassType = typeof(global::TUnit.TestProject.ArgsAsArrayTests), TestMethodName = "Params", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("arg1", "arg2", "arg3"), @@ -56,11 +56,120 @@ internal sealed class TUnit_TestProject_ArgsAsArrayTests_Params__string___TestSo Parent = null }) }, - InstanceFactory = TUnit_TestProject_ArgsAsArrayTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Params__string__, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_Params__string__.UseRuntimeDataGeneration(testSessionId); + var metadata_ParamsEnumerable__IEnumerable_string_ = new global::TUnit.Core.TestMetadata + { + TestName = "ParamsEnumerable", + TestClassType = typeof(global::TUnit.TestProject.ArgsAsArrayTests), + TestMethodName = "ParamsEnumerable", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute("arg1", "arg2", "arg3"), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 15, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.ArgsAsArrayTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ArgsAsArrayTests)), + Name = "ParamsEnumerable", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::System.Collections.Generic.IEnumerable)) + { + Name = "arguments", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Collections.Generic.IEnumerable)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ArgsAsArrayTests).GetMethod("ParamsEnumerable", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Collections.Generic.IEnumerable) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ArgsAsArrayTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ParamsEnumerable__IEnumerable_string_, + }; + metadata_ParamsEnumerable__IEnumerable_string_.UseRuntimeDataGeneration(testSessionId); + var metadata_Following_Non_Params__int_IEnumerable_string_ = new global::TUnit.Core.TestMetadata + { + TestName = "Following_Non_Params", + TestClassType = typeof(global::TUnit.TestProject.ArgsAsArrayTests), + TestMethodName = "Following_Non_Params", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(1, "arg1", "arg2", "arg3"), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 25, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.ArgsAsArrayTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ArgsAsArrayTests)), + Name = "Following_Non_Params", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "i", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ArgsAsArrayTests).GetMethod("Following_Non_Params", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(global::System.Collections.Generic.IEnumerable) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(global::System.Collections.Generic.IEnumerable)) + { + Name = "arguments", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Collections.Generic.IEnumerable)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ArgsAsArrayTests).GetMethod("Following_Non_Params", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(global::System.Collections.Generic.IEnumerable) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ArgsAsArrayTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Following_Non_Params__int_IEnumerable_string_, + }; + metadata_Following_Non_Params__int_IEnumerable_string_.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_Params__string__, metadata_ParamsEnumerable__IEnumerable_string_, metadata_Following_Non_Params__int_IEnumerable_string_ }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -77,17 +186,47 @@ internal sealed class TUnit_TestProject_ArgsAsArrayTests_Params__string___TestSo HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_Params__string__ + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.ArgsAsArrayTests.ParamsEnumerable", + ClassName = "ArgsAsArrayTests", + MethodName = "ParamsEnumerable", + FullyQualifiedName = "TUnit.TestProject.ArgsAsArrayTests.ParamsEnumerable", + FilePath = @"", + LineNumber = 15, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_ParamsEnumerable__IEnumerable_string_ + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.ArgsAsArrayTests.Following_Non_Params", + ClassName = "ArgsAsArrayTests", + MethodName = "Following_Non_Params", + FullyQualifiedName = "TUnit.TestProject.ArgsAsArrayTests.Following_Non_Params", + FilePath = @"", + LineNumber = 25, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Following_Non_Params__int_IEnumerable_string_ }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ new global::TUnit.Core.TestAttribute() ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ArgsAsArrayTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_Params__string__(global::TUnit.TestProject.ArgsAsArrayTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -137,29 +276,115 @@ internal sealed class TUnit_TestProject_ArgsAsArrayTests_Params__string___TestSo return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_ArgsAsArrayTests_ParamsEnumerable__IEnumerable_string__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata { - TestName = "ParamsEnumerable", + TestName = "Params", TestClassType = typeof(global::TUnit.TestProject.ArgsAsArrayTests), - TestMethodName = "ParamsEnumerable", + TestMethodName = "Params", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("arg1", "arg2", "arg3"), @@ -169,23 +394,23 @@ internal sealed class TUnit_TestProject_ArgsAsArrayTests_ParamsEnumerable__IEnum PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 15, + LineNumber = 5, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.ArgsAsArrayTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ArgsAsArrayTests)), - Name = "ParamsEnumerable", + Name = "Params", GenericTypeCount = 0, ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = new global::TUnit.Core.ParameterMetadata[] { - new global::TUnit.Core.ParameterMetadata(typeof(global::System.Collections.Generic.IEnumerable)) + new global::TUnit.Core.ParameterMetadata(typeof(string[])) { Name = "arguments", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Collections.Generic.IEnumerable)), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string[])), IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.ArgsAsArrayTests).GetMethod("ParamsEnumerable", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Collections.Generic.IEnumerable) }, null)!.GetParameters()[0] + ReflectionInfo = typeof(global::TUnit.TestProject.ArgsAsArrayTests).GetMethod("Params", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string[]) }, null)!.GetParameters()[0] } }, Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ArgsAsArrayTests", new global::TUnit.Core.ClassMetadata @@ -200,102 +425,68 @@ internal sealed class TUnit_TestProject_ArgsAsArrayTests_ParamsEnumerable__IEnum Parent = null }) }, - InstanceFactory = TUnit_TestProject_ArgsAsArrayTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Params__string__, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_ParamsEnumerable__IEnumerable_string_(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.ArgsAsArrayTests.ParamsEnumerable", - ClassName = "ArgsAsArrayTests", - MethodName = "ParamsEnumerable", - FullyQualifiedName = "TUnit.TestProject.ArgsAsArrayTests.ParamsEnumerable", + TestName = "ParamsEnumerable", + TestClassType = typeof(global::TUnit.TestProject.ArgsAsArrayTests), + TestMethodName = "ParamsEnumerable", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute("arg1", "arg2", "arg3"), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", LineNumber = 15, - 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() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ArgsAsArrayTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) + MethodMetadata = new global::TUnit.Core.MethodMetadata { - 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: + Type = typeof(global::TUnit.TestProject.ArgsAsArrayTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ArgsAsArrayTests)), + Name = "ParamsEnumerable", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::System.Collections.Generic.IEnumerable)) { - instance.ParamsEnumerable(global::TUnit.Core.Helpers.CastHelper.Cast>(args[0])); - return default(global::System.Threading.Tasks.ValueTask); + Name = "arguments", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Collections.Generic.IEnumerable)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ArgsAsArrayTests).GetMethod("ParamsEnumerable", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Collections.Generic.IEnumerable) }, null)!.GetParameters()[0] } - 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)); - } + }, + Class = 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ParamsEnumerable__IEnumerable_string_, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_ArgsAsArrayTests_Following_Non_Params__int_IEnumerable_string__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Following_Non_Params__int_IEnumerable_string_(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -303,7 +494,7 @@ internal sealed class TUnit_TestProject_ArgsAsArrayTests_Following_Non_Params__i TestClassType = typeof(global::TUnit.TestProject.ArgsAsArrayTests), TestMethodName = "Following_Non_Params", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1, "arg1", "arg2", "arg3"), @@ -351,101 +542,12 @@ internal sealed class TUnit_TestProject_ArgsAsArrayTests_Following_Non_Params__i Parent = null }) }, - InstanceFactory = TUnit_TestProject_ArgsAsArrayTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Following_Non_Params__int_IEnumerable_string_, }; 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.ArgsAsArrayTests.Following_Non_Params", - ClassName = "ArgsAsArrayTests", - MethodName = "Following_Non_Params", - FullyQualifiedName = "TUnit.TestProject.ArgsAsArrayTests.Following_Non_Params", - FilePath = @"", - LineNumber = 25, - 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() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ArgsAsArrayTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.Following_Non_Params(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast>(args[1])); - return default(global::System.Threading.Tasks.ValueTask); - } - case 2: - { - instance.Following_Non_Params(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast>(args[1])); - return default(global::System.Threading.Tasks.ValueTask); - } - case 3: - { - instance.Following_Non_Params(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast>(args[1])); - return default(global::System.Threading.Tasks.ValueTask); - } - case 4: - { - instance.Following_Non_Params(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast>(args[1])); - return default(global::System.Threading.Tasks.ValueTask); - } - case 5: - { - instance.Following_Non_Params(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast>(args[1])); - return default(global::System.Threading.Tasks.ValueTask); - } - case 6: - { - instance.Following_Non_Params(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast>(args[1])); - return default(global::System.Threading.Tasks.ValueTask); - } - case 7: - { - instance.Following_Non_Params(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast>(args[1])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected between 1 and 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_ArgsAsArrayTests__ClassHelper -{ internal static global::TUnit.TestProject.ArgsAsArrayTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.ArgsAsArrayTests(); @@ -453,8 +555,6 @@ internal static class TUnit_TestProject_ArgsAsArrayTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ArgsAsArrayTests), new TUnit_TestProject_ArgsAsArrayTests_Following_Non_Params__int_IEnumerable_string__TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ArgsAsArrayTests), new TUnit_TestProject_ArgsAsArrayTests_ParamsEnumerable__IEnumerable_string__TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ArgsAsArrayTests), new TUnit_TestProject_ArgsAsArrayTests_Params__string___TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ArgsAsArrayTests), new TUnit_TestProject_ArgsAsArrayTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/ArgumentWithImplicitConverterTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ArgumentWithImplicitConverterTests.Test.verified.txt index f5cbfe8483f..9cfcbfed045 100644 --- a/TUnit.Core.SourceGenerator.Tests/ArgumentWithImplicitConverterTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ArgumentWithImplicitConverterTests.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_ArgumentWithImplicitConverterTests_Explicit__ExplicitInteger_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_ArgumentWithImplicitConverterTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_Explicit__ExplicitInteger = new global::TUnit.Core.TestMetadata { TestName = "Explicit", TestClassType = typeof(global::TUnit.TestProject.ArgumentWithImplicitConverterTests), TestMethodName = "Explicit", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1), @@ -58,11 +58,64 @@ internal sealed class TUnit_TestProject_ArgumentWithImplicitConverterTests_Expli Parent = null }) }, - InstanceFactory = TUnit_TestProject_ArgumentWithImplicitConverterTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Explicit__ExplicitInteger, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_Explicit__ExplicitInteger.UseRuntimeDataGeneration(testSessionId); + var metadata_Implicit__ImplicitInteger = new global::TUnit.Core.TestMetadata + { + TestName = "Implicit", + TestClassType = typeof(global::TUnit.TestProject.ArgumentWithImplicitConverterTests), + TestMethodName = "Implicit", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 17, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.ArgumentWithImplicitConverterTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ArgumentWithImplicitConverterTests)), + Name = "Implicit", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.ImplicitInteger)) + { + Name = "integer", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ImplicitInteger)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ArgumentWithImplicitConverterTests).GetMethod("Implicit", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.ImplicitInteger) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ArgumentWithImplicitConverterTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Implicit__ImplicitInteger, + }; + metadata_Implicit__ImplicitInteger.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_Explicit__ExplicitInteger, metadata_Implicit__ImplicitInteger }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -79,10 +132,25 @@ internal sealed class TUnit_TestProject_ArgumentWithImplicitConverterTests_Expli HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_Explicit__ExplicitInteger + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.ArgumentWithImplicitConverterTests.Implicit", + ClassName = "ArgumentWithImplicitConverterTests", + MethodName = "Implicit", + FullyQualifiedName = "TUnit.TestProject.ArgumentWithImplicitConverterTests.Implicit", + FilePath = @"", + LineNumber = 17, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Implicit__ImplicitInteger }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -90,7 +158,7 @@ internal sealed class TUnit_TestProject_ArgumentWithImplicitConverterTests_Expli new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ArgumentWithImplicitConverterTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_Explicit__ExplicitInteger(global::TUnit.TestProject.ArgumentWithImplicitConverterTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -110,29 +178,35 @@ internal sealed class TUnit_TestProject_ArgumentWithImplicitConverterTests_Expli return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_ArgumentWithImplicitConverterTests_Implicit__ImplicitInteger_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata { - TestName = "Implicit", + TestName = "Explicit", TestClassType = typeof(global::TUnit.TestProject.ArgumentWithImplicitConverterTests), - TestMethodName = "Implicit", + TestMethodName = "Explicit", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1), @@ -144,23 +218,23 @@ internal sealed class TUnit_TestProject_ArgumentWithImplicitConverterTests_Impli PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 17, + LineNumber = 8, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.ArgumentWithImplicitConverterTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ArgumentWithImplicitConverterTests)), - Name = "Implicit", + Name = "Explicit", GenericTypeCount = 0, ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = new global::TUnit.Core.ParameterMetadata[] { - new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.ImplicitInteger)) + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.ExplicitInteger)) { Name = "integer", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ImplicitInteger)), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ExplicitInteger)), IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.ArgumentWithImplicitConverterTests).GetMethod("Implicit", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.ImplicitInteger) }, null)!.GetParameters()[0] + ReflectionInfo = typeof(global::TUnit.TestProject.ArgumentWithImplicitConverterTests).GetMethod("Explicit", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.ExplicitInteger) }, null)!.GetParameters()[0] } }, Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ArgumentWithImplicitConverterTests", new global::TUnit.Core.ClassMetadata @@ -175,72 +249,69 @@ internal sealed class TUnit_TestProject_ArgumentWithImplicitConverterTests_Impli Parent = null }) }, - InstanceFactory = TUnit_TestProject_ArgumentWithImplicitConverterTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Explicit__ExplicitInteger, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Implicit__ImplicitInteger(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.ArgumentWithImplicitConverterTests.Implicit", - ClassName = "ArgumentWithImplicitConverterTests", - MethodName = "Implicit", - FullyQualifiedName = "TUnit.TestProject.ArgumentWithImplicitConverterTests.Implicit", + TestName = "Implicit", + TestClassType = typeof(global::TUnit.TestProject.ArgumentWithImplicitConverterTests), + TestMethodName = "Implicit", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", LineNumber = 17, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ArgumentWithImplicitConverterTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) + MethodMetadata = new global::TUnit.Core.MethodMetadata { - case 1: + Type = typeof(global::TUnit.TestProject.ArgumentWithImplicitConverterTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ArgumentWithImplicitConverterTests)), + Name = "Implicit", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.ImplicitInteger)) { - instance.Implicit(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); + Name = "integer", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ImplicitInteger)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ArgumentWithImplicitConverterTests).GetMethod("Implicit", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.ImplicitInteger) }, null)!.GetParameters()[0] } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } + }, + Class = 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Implicit__ImplicitInteger, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_ArgumentWithImplicitConverterTests__ClassHelper -{ internal static global::TUnit.TestProject.ArgumentWithImplicitConverterTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.ArgumentWithImplicitConverterTests(); @@ -248,7 +319,6 @@ internal static class TUnit_TestProject_ArgumentWithImplicitConverterTests__Clas [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ArgumentWithImplicitConverterTests), new TUnit_TestProject_ArgumentWithImplicitConverterTests_Explicit__ExplicitInteger_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ArgumentWithImplicitConverterTests), new TUnit_TestProject_ArgumentWithImplicitConverterTests_Implicit__ImplicitInteger_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ArgumentWithImplicitConverterTests), new TUnit_TestProject_ArgumentWithImplicitConverterTests__TestSource()); } } 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 6ac3112a9b7..e8cb6263039 100644 --- a/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet10_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet10_0.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_BasicTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_SynchronousTest = new global::TUnit.Core.TestMetadata { TestName = "SynchronousTest", TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -44,11 +44,89 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SynchronousTest, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_SynchronousTest.UseRuntimeDataGeneration(testSessionId); + var metadata_AsynchronousTest = new global::TUnit.Core.TestMetadata + { + TestName = "AsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "AsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 11, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "AsynchronousTest", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsynchronousTest, + }; + metadata_AsynchronousTest.UseRuntimeDataGeneration(testSessionId); + var metadata_ValueTaskAsynchronousTest = new global::TUnit.Core.TestMetadata + { + TestName = "ValueTaskAsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "ValueTaskAsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 17, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "ValueTaskAsynchronousTest", + GenericTypeCount = 0, + ReturnType = typeof(global::System.Threading.Tasks.ValueTask), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.ValueTask)), + Parameters = global::System.Array.Empty(), + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ValueTaskAsynchronousTest, + }; + metadata_ValueTaskAsynchronousTest.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_SynchronousTest, metadata_AsynchronousTest, metadata_ValueTaskAsynchronousTest }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -65,17 +143,47 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_SynchronousTest + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", + ClassName = "BasicTests", + MethodName = "AsynchronousTest", + FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", + FilePath = @"", + LineNumber = 11, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_AsynchronousTest + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + ClassName = "BasicTests", + MethodName = "ValueTaskAsynchronousTest", + FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + FilePath = @"", + LineNumber = 17, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_ValueTaskAsynchronousTest }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ new global::TUnit.Core.TestAttribute() ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_SynchronousTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -87,44 +195,52 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata { - TestName = "AsynchronousTest", + TestName = "SynchronousTest", TestClassType = typeof(global::TUnit.TestProject.BasicTests), - TestMethodName = "AsynchronousTest", + TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 11, + LineNumber = 5, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.BasicTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "AsynchronousTest", + Name = "SynchronousTest", GenericTypeCount = 0, - ReturnType = typeof(global::System.Threading.Tasks.Task), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { @@ -138,63 +254,56 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SynchronousTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsynchronousTest(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", - ClassName = "BasicTests", - MethodName = "AsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", + TestName = "AsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "AsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", LineNumber = 11, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "AsynchronousTest", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsynchronousTest, }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_ValueTaskAsynchronousTest(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -202,7 +311,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "ValueTaskAsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -231,62 +340,12 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ValueTaskAsynchronousTest, }; 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.BasicTests.ValueTaskAsynchronousTest", - ClassName = "BasicTests", - MethodName = "ValueTaskAsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - FilePath = @"", - LineNumber = 17, - 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() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return instance.ValueTaskAsynchronousTest(); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_BasicTests__ClassHelper -{ internal static global::TUnit.TestProject.BasicTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.BasicTests(); @@ -294,8 +353,6 @@ internal static class TUnit_TestProject_BasicTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_AsynchronousTest_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_SynchronousTest_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests__TestSource()); } } 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 6ac3112a9b7..e8cb6263039 100644 --- a/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet8_0.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_BasicTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_SynchronousTest = new global::TUnit.Core.TestMetadata { TestName = "SynchronousTest", TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -44,11 +44,89 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SynchronousTest, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_SynchronousTest.UseRuntimeDataGeneration(testSessionId); + var metadata_AsynchronousTest = new global::TUnit.Core.TestMetadata + { + TestName = "AsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "AsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 11, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "AsynchronousTest", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsynchronousTest, + }; + metadata_AsynchronousTest.UseRuntimeDataGeneration(testSessionId); + var metadata_ValueTaskAsynchronousTest = new global::TUnit.Core.TestMetadata + { + TestName = "ValueTaskAsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "ValueTaskAsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 17, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "ValueTaskAsynchronousTest", + GenericTypeCount = 0, + ReturnType = typeof(global::System.Threading.Tasks.ValueTask), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.ValueTask)), + Parameters = global::System.Array.Empty(), + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ValueTaskAsynchronousTest, + }; + metadata_ValueTaskAsynchronousTest.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_SynchronousTest, metadata_AsynchronousTest, metadata_ValueTaskAsynchronousTest }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -65,17 +143,47 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_SynchronousTest + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", + ClassName = "BasicTests", + MethodName = "AsynchronousTest", + FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", + FilePath = @"", + LineNumber = 11, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_AsynchronousTest + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + ClassName = "BasicTests", + MethodName = "ValueTaskAsynchronousTest", + FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + FilePath = @"", + LineNumber = 17, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_ValueTaskAsynchronousTest }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ new global::TUnit.Core.TestAttribute() ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_SynchronousTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -87,44 +195,52 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata { - TestName = "AsynchronousTest", + TestName = "SynchronousTest", TestClassType = typeof(global::TUnit.TestProject.BasicTests), - TestMethodName = "AsynchronousTest", + TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 11, + LineNumber = 5, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.BasicTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "AsynchronousTest", + Name = "SynchronousTest", GenericTypeCount = 0, - ReturnType = typeof(global::System.Threading.Tasks.Task), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { @@ -138,63 +254,56 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SynchronousTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsynchronousTest(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", - ClassName = "BasicTests", - MethodName = "AsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", + TestName = "AsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "AsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", LineNumber = 11, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "AsynchronousTest", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsynchronousTest, }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_ValueTaskAsynchronousTest(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -202,7 +311,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "ValueTaskAsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -231,62 +340,12 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ValueTaskAsynchronousTest, }; 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.BasicTests.ValueTaskAsynchronousTest", - ClassName = "BasicTests", - MethodName = "ValueTaskAsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - FilePath = @"", - LineNumber = 17, - 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() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return instance.ValueTaskAsynchronousTest(); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_BasicTests__ClassHelper -{ internal static global::TUnit.TestProject.BasicTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.BasicTests(); @@ -294,8 +353,6 @@ internal static class TUnit_TestProject_BasicTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_AsynchronousTest_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_SynchronousTest_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests__TestSource()); } } 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 6ac3112a9b7..e8cb6263039 100644 --- a/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.DotNet9_0.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_BasicTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_SynchronousTest = new global::TUnit.Core.TestMetadata { TestName = "SynchronousTest", TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -44,11 +44,89 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SynchronousTest, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_SynchronousTest.UseRuntimeDataGeneration(testSessionId); + var metadata_AsynchronousTest = new global::TUnit.Core.TestMetadata + { + TestName = "AsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "AsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 11, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "AsynchronousTest", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsynchronousTest, + }; + metadata_AsynchronousTest.UseRuntimeDataGeneration(testSessionId); + var metadata_ValueTaskAsynchronousTest = new global::TUnit.Core.TestMetadata + { + TestName = "ValueTaskAsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "ValueTaskAsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 17, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "ValueTaskAsynchronousTest", + GenericTypeCount = 0, + ReturnType = typeof(global::System.Threading.Tasks.ValueTask), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.ValueTask)), + Parameters = global::System.Array.Empty(), + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ValueTaskAsynchronousTest, + }; + metadata_ValueTaskAsynchronousTest.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_SynchronousTest, metadata_AsynchronousTest, metadata_ValueTaskAsynchronousTest }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -65,17 +143,47 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_SynchronousTest + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", + ClassName = "BasicTests", + MethodName = "AsynchronousTest", + FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", + FilePath = @"", + LineNumber = 11, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_AsynchronousTest + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + ClassName = "BasicTests", + MethodName = "ValueTaskAsynchronousTest", + FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + FilePath = @"", + LineNumber = 17, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_ValueTaskAsynchronousTest }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ new global::TUnit.Core.TestAttribute() ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_SynchronousTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -87,44 +195,52 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata { - TestName = "AsynchronousTest", + TestName = "SynchronousTest", TestClassType = typeof(global::TUnit.TestProject.BasicTests), - TestMethodName = "AsynchronousTest", + TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 11, + LineNumber = 5, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.BasicTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "AsynchronousTest", + Name = "SynchronousTest", GenericTypeCount = 0, - ReturnType = typeof(global::System.Threading.Tasks.Task), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { @@ -138,63 +254,56 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SynchronousTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsynchronousTest(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", - ClassName = "BasicTests", - MethodName = "AsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", + TestName = "AsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "AsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", LineNumber = 11, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "AsynchronousTest", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsynchronousTest, }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_ValueTaskAsynchronousTest(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -202,7 +311,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "ValueTaskAsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -231,62 +340,12 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ValueTaskAsynchronousTest, }; 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.BasicTests.ValueTaskAsynchronousTest", - ClassName = "BasicTests", - MethodName = "ValueTaskAsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - FilePath = @"", - LineNumber = 17, - 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() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return instance.ValueTaskAsynchronousTest(); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_BasicTests__ClassHelper -{ internal static global::TUnit.TestProject.BasicTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.BasicTests(); @@ -294,8 +353,6 @@ internal static class TUnit_TestProject_BasicTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_AsynchronousTest_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_SynchronousTest_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests__TestSource()); } } 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 abf00eea2c1..f717b59d6f0 100644 --- a/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.Net4_7.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AssemblyLoaderTests.Test.Net4_7.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_BasicTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_SynchronousTest = new global::TUnit.Core.TestMetadata { TestName = "SynchronousTest", TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -44,11 +44,89 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SynchronousTest, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_SynchronousTest.UseRuntimeDataGeneration(testSessionId); + var metadata_AsynchronousTest = new global::TUnit.Core.TestMetadata + { + TestName = "AsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "AsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 11, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "AsynchronousTest", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsynchronousTest, + }; + metadata_AsynchronousTest.UseRuntimeDataGeneration(testSessionId); + var metadata_ValueTaskAsynchronousTest = new global::TUnit.Core.TestMetadata + { + TestName = "ValueTaskAsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "ValueTaskAsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 17, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "ValueTaskAsynchronousTest", + GenericTypeCount = 0, + ReturnType = typeof(global::System.Threading.Tasks.ValueTask), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.ValueTask)), + Parameters = global::System.Array.Empty(), + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ValueTaskAsynchronousTest, + }; + metadata_ValueTaskAsynchronousTest.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_SynchronousTest, metadata_AsynchronousTest, metadata_ValueTaskAsynchronousTest }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -65,17 +143,47 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_SynchronousTest + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", + ClassName = "BasicTests", + MethodName = "AsynchronousTest", + FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", + FilePath = @"", + LineNumber = 11, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_AsynchronousTest + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + ClassName = "BasicTests", + MethodName = "ValueTaskAsynchronousTest", + FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + FilePath = @"", + LineNumber = 17, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_ValueTaskAsynchronousTest }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ new global::TUnit.Core.TestAttribute() ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_SynchronousTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -87,44 +195,52 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata { - TestName = "AsynchronousTest", + TestName = "SynchronousTest", TestClassType = typeof(global::TUnit.TestProject.BasicTests), - TestMethodName = "AsynchronousTest", + TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 11, + LineNumber = 5, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.BasicTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "AsynchronousTest", + Name = "SynchronousTest", GenericTypeCount = 0, - ReturnType = typeof(global::System.Threading.Tasks.Task), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { @@ -138,63 +254,56 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SynchronousTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsynchronousTest(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", - ClassName = "BasicTests", - MethodName = "AsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", + TestName = "AsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "AsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", LineNumber = 11, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "AsynchronousTest", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsynchronousTest, }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_ValueTaskAsynchronousTest(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -202,7 +311,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "ValueTaskAsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -231,62 +340,12 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ValueTaskAsynchronousTest, }; 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.BasicTests.ValueTaskAsynchronousTest", - ClassName = "BasicTests", - MethodName = "ValueTaskAsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - FilePath = @"", - LineNumber = 17, - 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() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return instance.ValueTaskAsynchronousTest(); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_BasicTests__ClassHelper -{ internal static global::TUnit.TestProject.BasicTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.BasicTests(); @@ -294,8 +353,6 @@ internal static class TUnit_TestProject_BasicTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_AsynchronousTest_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_SynchronousTest_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/AsyncMethodDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/AsyncMethodDataSourceDrivenTests.Test.verified.txt index 03ebe9acb76..71cfc990a4b 100644 --- a/TUnit.Core.SourceGenerator.Tests/AsyncMethodDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AsyncMethodDataSourceDrivenTests.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMethodDataSource_SingleValue__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_AsyncMethodDataSource_SingleValue__int = new global::TUnit.Core.TestMetadata { TestName = "AsyncMethodDataSource_SingleValue", TestClassType = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), TestMethodName = "AsyncMethodDataSource_SingleValue", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("AsyncDataMethod") @@ -77,80 +77,17 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe Parent = null }) }, - InstanceFactory = TUnit_TestProject_AsyncMethodDataSourceDrivenTests__ClassHelper.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.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_SingleValue", - ClassName = "AsyncMethodDataSourceDrivenTests", - MethodName = "AsyncMethodDataSource_SingleValue", - FullyQualifiedName = "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_SingleValue", - FilePath = @"", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsyncMethodDataSource_SingleValue__int, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.AsyncMethodDataSource_SingleValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMethodDataSource_Tuples__int_string_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_AsyncMethodDataSource_SingleValue__int.UseRuntimeDataGeneration(testSessionId); + var metadata_AsyncMethodDataSource_Tuples__int_string = new global::TUnit.Core.TestMetadata { TestName = "AsyncMethodDataSource_Tuples", TestClassType = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), TestMethodName = "AsyncMethodDataSource_Tuples", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("AsyncDataMethodWithTuples") @@ -219,80 +156,17 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe Parent = null }) }, - InstanceFactory = TUnit_TestProject_AsyncMethodDataSourceDrivenTests__ClassHelper.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.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_Tuples", - ClassName = "AsyncMethodDataSourceDrivenTests", - MethodName = "AsyncMethodDataSource_Tuples", - FullyQualifiedName = "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_Tuples", - FilePath = @"", - LineNumber = 15, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsyncMethodDataSource_Tuples__int_string, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.AsyncMethodDataSource_Tuples(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMethodDataSource_Enumerable__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_AsyncMethodDataSource_Tuples__int_string.UseRuntimeDataGeneration(testSessionId); + var metadata_AsyncMethodDataSource_Enumerable__int = new global::TUnit.Core.TestMetadata { TestName = "AsyncMethodDataSource_Enumerable", TestClassType = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), TestMethodName = "AsyncMethodDataSource_Enumerable", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("AsyncEnumerableDataMethod") @@ -354,80 +228,17 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe Parent = null }) }, - InstanceFactory = TUnit_TestProject_AsyncMethodDataSourceDrivenTests__ClassHelper.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.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_Enumerable", - ClassName = "AsyncMethodDataSourceDrivenTests", - MethodName = "AsyncMethodDataSource_Enumerable", - FullyQualifiedName = "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_Enumerable", - FilePath = @"", - LineNumber = 23, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsyncMethodDataSource_Enumerable__int, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.AsyncMethodDataSource_Enumerable(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMethodDataSource_Func__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_AsyncMethodDataSource_Enumerable__int.UseRuntimeDataGeneration(testSessionId); + var metadata_AsyncMethodDataSource_Func__int = new global::TUnit.Core.TestMetadata { TestName = "AsyncMethodDataSource_Func", TestClassType = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), TestMethodName = "AsyncMethodDataSource_Func", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("AsyncFuncDataMethod") @@ -489,80 +300,17 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe Parent = null }) }, - InstanceFactory = TUnit_TestProject_AsyncMethodDataSourceDrivenTests__ClassHelper.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.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_Func", - ClassName = "AsyncMethodDataSourceDrivenTests", - MethodName = "AsyncMethodDataSource_Func", - FullyQualifiedName = "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_Func", - FilePath = @"", - LineNumber = 30, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsyncMethodDataSource_Func__int, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.AsyncMethodDataSource_Func(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMethodDataSource_WithArguments__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_AsyncMethodDataSource_Func__int.UseRuntimeDataGeneration(testSessionId); + var metadata_AsyncMethodDataSource_WithArguments__int = new global::TUnit.Core.TestMetadata { TestName = "AsyncMethodDataSource_WithArguments", TestClassType = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), TestMethodName = "AsyncMethodDataSource_WithArguments", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("AsyncDataMethodWithArgs") @@ -624,80 +372,17 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe Parent = null }) }, - InstanceFactory = TUnit_TestProject_AsyncMethodDataSourceDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsyncMethodDataSource_WithArguments__int, }; - 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.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_WithArguments", - ClassName = "AsyncMethodDataSourceDrivenTests", - MethodName = "AsyncMethodDataSource_WithArguments", - FullyQualifiedName = "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_WithArguments", - FilePath = @"", - LineNumber = 37, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.AsyncMethodDataSource_WithArguments(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMethodDataSource_ExternalClass__string_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_AsyncMethodDataSource_WithArguments__int.UseRuntimeDataGeneration(testSessionId); + var metadata_AsyncMethodDataSource_ExternalClass__string = new global::TUnit.Core.TestMetadata { TestName = "AsyncMethodDataSource_ExternalClass", TestClassType = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), TestMethodName = "AsyncMethodDataSource_ExternalClass", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.AsyncExternalDataSource), "GetData") @@ -759,80 +444,17 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMe Parent = null }) }, - InstanceFactory = TUnit_TestProject_AsyncMethodDataSourceDrivenTests__ClassHelper.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.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 = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsyncMethodDataSource_ExternalClass__string, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.AsyncMethodDataSource_ExternalClass(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_ValueTaskMethodDataSource_SingleValue__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_AsyncMethodDataSource_ExternalClass__string.UseRuntimeDataGeneration(testSessionId); + var metadata_ValueTaskMethodDataSource_SingleValue__int = new global::TUnit.Core.TestMetadata { TestName = "ValueTaskMethodDataSource_SingleValue", TestClassType = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), TestMethodName = "ValueTaskMethodDataSource_SingleValue", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("ValueTaskDataMethod") @@ -894,14 +516,104 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_ValueTa Parent = null }) }, - InstanceFactory = TUnit_TestProject_AsyncMethodDataSourceDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ValueTaskMethodDataSource_SingleValue__int, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_ValueTaskMethodDataSource_SingleValue__int.UseRuntimeDataGeneration(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 }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_SingleValue", + ClassName = "AsyncMethodDataSourceDrivenTests", + MethodName = "AsyncMethodDataSource_SingleValue", + FullyQualifiedName = "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_SingleValue", + FilePath = @"", + LineNumber = 8, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_AsyncMethodDataSource_SingleValue__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_Tuples", + ClassName = "AsyncMethodDataSourceDrivenTests", + MethodName = "AsyncMethodDataSource_Tuples", + FullyQualifiedName = "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_Tuples", + FilePath = @"", + LineNumber = 15, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_AsyncMethodDataSource_Tuples__int_string + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_Enumerable", + ClassName = "AsyncMethodDataSourceDrivenTests", + MethodName = "AsyncMethodDataSource_Enumerable", + FullyQualifiedName = "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_Enumerable", + FilePath = @"", + LineNumber = 23, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_AsyncMethodDataSource_Enumerable__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_Func", + ClassName = "AsyncMethodDataSourceDrivenTests", + MethodName = "AsyncMethodDataSource_Func", + FullyQualifiedName = "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_Func", + FilePath = @"", + LineNumber = 30, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_AsyncMethodDataSource_Func__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_WithArguments", + ClassName = "AsyncMethodDataSourceDrivenTests", + MethodName = "AsyncMethodDataSource_WithArguments", + FullyQualifiedName = "TUnit.TestProject.AsyncMethodDataSourceDrivenTests.AsyncMethodDataSource_WithArguments", + FilePath = @"", + LineNumber = 37, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + 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", @@ -915,10 +627,10 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_ValueTa HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_ValueTaskMethodDataSource_SingleValue__int }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -926,7 +638,7 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_ValueTa new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_AsyncMethodDataSource_SingleValue__int(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -934,7 +646,7 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_ValueTa { case 1: { - return new global::System.Threading.Tasks.ValueTask(instance.ValueTaskMethodDataSource_SingleValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + 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}"); @@ -945,20 +657,659 @@ internal sealed class TUnit_TestProject_AsyncMethodDataSourceDrivenTests_ValueTa return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_AsyncMethodDataSourceDrivenTests__ClassHelper -{ + 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 metadata = new global::TUnit.Core.TestMetadata + { + TestName = "AsyncMethodDataSource_SingleValue", + TestClassType = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), + TestMethodName = "AsyncMethodDataSource_SingleValue", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = 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(); + } + }, + }, + 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 + { + Type = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests)), + Name = "AsyncMethodDataSource_SingleValue", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests).GetMethod("AsyncMethodDataSource_SingleValue", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsyncMethodDataSource_SingleValue__int, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsyncMethodDataSource_Tuples__int_string(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "AsyncMethodDataSource_Tuples", + TestClassType = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), + TestMethodName = "AsyncMethodDataSource_Tuples", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = 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(); + } + }, + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 15, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests)), + Name = "AsyncMethodDataSource_Tuples", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value1", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests).GetMethod("AsyncMethodDataSource_Tuples", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "value2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests).GetMethod("AsyncMethodDataSource_Tuples", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsyncMethodDataSource_Tuples__int_string, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsyncMethodDataSource_Enumerable__int(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "AsyncMethodDataSource_Enumerable", + TestClassType = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), + TestMethodName = "AsyncMethodDataSource_Enumerable", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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(); + } + }, + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 23, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests)), + Name = "AsyncMethodDataSource_Enumerable", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests).GetMethod("AsyncMethodDataSource_Enumerable", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsyncMethodDataSource_Enumerable__int, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsyncMethodDataSource_Func__int(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "AsyncMethodDataSource_Func", + TestClassType = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), + TestMethodName = "AsyncMethodDataSource_Func", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = 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(); + } + }, + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 30, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests)), + Name = "AsyncMethodDataSource_Func", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests).GetMethod("AsyncMethodDataSource_Func", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsyncMethodDataSource_Func__int, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsyncMethodDataSource_WithArguments__int(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "AsyncMethodDataSource_WithArguments", + TestClassType = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), + TestMethodName = "AsyncMethodDataSource_WithArguments", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.MethodDataSourceAttribute("AsyncDataMethodWithArgs") + { + Factory = (dataGeneratorMetadata) => + { + 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)) + { + 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(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 37, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests)), + Name = "AsyncMethodDataSource_WithArguments", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests).GetMethod("AsyncMethodDataSource_WithArguments", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsyncMethodDataSource_WithArguments__int, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsyncMethodDataSource_ExternalClass__string(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "AsyncMethodDataSource_ExternalClass", + TestClassType = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), + TestMethodName = "AsyncMethodDataSource_ExternalClass", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.AsyncExternalDataSource), "GetData") + { + Factory = (dataGeneratorMetadata) => + { + 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)) + { + 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(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 44, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests)), + Name = "AsyncMethodDataSource_ExternalClass", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests).GetMethod("AsyncMethodDataSource_ExternalClass", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsyncMethodDataSource_ExternalClass__string, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_ValueTaskMethodDataSource_SingleValue__int(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "ValueTaskMethodDataSource_SingleValue", + TestClassType = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), + TestMethodName = "ValueTaskMethodDataSource_SingleValue", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.MethodDataSourceAttribute("ValueTaskDataMethod") + { + Factory = (dataGeneratorMetadata) => + { + 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)) + { + 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(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 51, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests)), + Name = "ValueTaskMethodDataSource_SingleValue", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests).GetMethod("ValueTaskMethodDataSource_SingleValue", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ValueTaskMethodDataSource_SingleValue__int, + }; + metadata.UseRuntimeDataGeneration(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(); @@ -966,12 +1317,6 @@ internal static class TUnit_TestProject_AsyncMethodDataSourceDrivenTests__ClassH [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), new TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMethodDataSource_Enumerable__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), new TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMethodDataSource_ExternalClass__string_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), new TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMethodDataSource_Func__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), new TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMethodDataSource_SingleValue__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), new TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMethodDataSource_Tuples__int_string_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), new TUnit_TestProject_AsyncMethodDataSourceDrivenTests_AsyncMethodDataSource_WithArguments__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), new TUnit_TestProject_AsyncMethodDataSourceDrivenTests_ValueTaskMethodDataSource_SingleValue__int_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AsyncMethodDataSourceDrivenTests), new TUnit_TestProject_AsyncMethodDataSourceDrivenTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/AttributeTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/AttributeTests.Test.verified.txt index 6c263c7b61a..6e50df681c2 100644 --- a/TUnit.Core.SourceGenerator.Tests/AttributeTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/AttributeTests.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_AttributeTests_MyTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_AttributeTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_MyTest = new global::TUnit.Core.TestMetadata { TestName = "MyTest", TestClassType = typeof(global::TUnit.TestProject.AttributeTests), TestMethodName = "MyTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -44,11 +44,11 @@ internal sealed class TUnit_TestProject_AttributeTests_MyTest_TestSource : globa Parent = null }) }, - InstanceFactory = TUnit_TestProject_AttributeTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MyTest, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_MyTest.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_MyTest }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -65,10 +65,10 @@ internal sealed class TUnit_TestProject_AttributeTests_MyTest_TestSource : globa HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_MyTest }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -78,16 +78,16 @@ internal sealed class TUnit_TestProject_AttributeTests_MyTest_TestSource : globa new global::TUnit.TestProject.AttributeTests.MixedAttribute("Foo", "Bar"), new global::TUnit.TestProject.AttributeTests.MixedAttribute(property2: "Foo"), new global::TUnit.TestProject.AttributeTests.MixedAttribute() -{Property = "Foo",}, + {Property = "Foo",}, new global::TUnit.TestProject.AttributeTests.MixedAttribute("Foo") -{Property = "Bar",}, + {Property = "Bar",}, new global::TUnit.TestProject.AttributeTests.MixedAttribute(property2: "Foo") -{Property = "Bar",}, + {Property = "Bar",}, new global::TUnit.TestProject.AttributeTests.MixedAttribute() -{Property = "Foo",Property2 = 1,} + {Property = "Foo",Property2 = 1,} ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AttributeTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_MyTest(global::TUnit.TestProject.AttributeTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -99,20 +99,49 @@ internal sealed class TUnit_TestProject_AttributeTests_MyTest_TestSource : globa return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_AttributeTests__ClassHelper -{ + private static global::System.Collections.Generic.IReadOnlyList __Materialize_MyTest(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "MyTest", + TestClassType = typeof(global::TUnit.TestProject.AttributeTests), + TestMethodName = "MyTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 + { + Type = typeof(global::TUnit.TestProject.AttributeTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AttributeTests)), + Name = "MyTest", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MyTest, + }; + metadata.UseRuntimeDataGeneration(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(); @@ -120,6 +149,6 @@ internal static class TUnit_TestProject_AttributeTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AttributeTests), new TUnit_TestProject_AttributeTests_MyTest_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AttributeTests), new TUnit_TestProject_AttributeTests__TestSource()); } } 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 6ac3112a9b7..e8cb6263039 100644 --- a/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet10_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet10_0.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_BasicTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_SynchronousTest = new global::TUnit.Core.TestMetadata { TestName = "SynchronousTest", TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -44,11 +44,89 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SynchronousTest, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_SynchronousTest.UseRuntimeDataGeneration(testSessionId); + var metadata_AsynchronousTest = new global::TUnit.Core.TestMetadata + { + TestName = "AsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "AsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 11, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "AsynchronousTest", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsynchronousTest, + }; + metadata_AsynchronousTest.UseRuntimeDataGeneration(testSessionId); + var metadata_ValueTaskAsynchronousTest = new global::TUnit.Core.TestMetadata + { + TestName = "ValueTaskAsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "ValueTaskAsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 17, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "ValueTaskAsynchronousTest", + GenericTypeCount = 0, + ReturnType = typeof(global::System.Threading.Tasks.ValueTask), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.ValueTask)), + Parameters = global::System.Array.Empty(), + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ValueTaskAsynchronousTest, + }; + metadata_ValueTaskAsynchronousTest.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_SynchronousTest, metadata_AsynchronousTest, metadata_ValueTaskAsynchronousTest }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -65,17 +143,47 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_SynchronousTest + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", + ClassName = "BasicTests", + MethodName = "AsynchronousTest", + FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", + FilePath = @"", + LineNumber = 11, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_AsynchronousTest + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + ClassName = "BasicTests", + MethodName = "ValueTaskAsynchronousTest", + FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + FilePath = @"", + LineNumber = 17, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_ValueTaskAsynchronousTest }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ new global::TUnit.Core.TestAttribute() ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_SynchronousTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -87,44 +195,52 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata { - TestName = "AsynchronousTest", + TestName = "SynchronousTest", TestClassType = typeof(global::TUnit.TestProject.BasicTests), - TestMethodName = "AsynchronousTest", + TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 11, + LineNumber = 5, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.BasicTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "AsynchronousTest", + Name = "SynchronousTest", GenericTypeCount = 0, - ReturnType = typeof(global::System.Threading.Tasks.Task), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { @@ -138,63 +254,56 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SynchronousTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsynchronousTest(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", - ClassName = "BasicTests", - MethodName = "AsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", + TestName = "AsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "AsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", LineNumber = 11, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "AsynchronousTest", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsynchronousTest, }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_ValueTaskAsynchronousTest(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -202,7 +311,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "ValueTaskAsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -231,62 +340,12 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ValueTaskAsynchronousTest, }; 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.BasicTests.ValueTaskAsynchronousTest", - ClassName = "BasicTests", - MethodName = "ValueTaskAsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - FilePath = @"", - LineNumber = 17, - 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() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return instance.ValueTaskAsynchronousTest(); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_BasicTests__ClassHelper -{ internal static global::TUnit.TestProject.BasicTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.BasicTests(); @@ -294,8 +353,6 @@ internal static class TUnit_TestProject_BasicTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_AsynchronousTest_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_SynchronousTest_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests__TestSource()); } } 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 6ac3112a9b7..e8cb6263039 100644 --- a/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet8_0.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_BasicTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_SynchronousTest = new global::TUnit.Core.TestMetadata { TestName = "SynchronousTest", TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -44,11 +44,89 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SynchronousTest, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_SynchronousTest.UseRuntimeDataGeneration(testSessionId); + var metadata_AsynchronousTest = new global::TUnit.Core.TestMetadata + { + TestName = "AsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "AsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 11, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "AsynchronousTest", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsynchronousTest, + }; + metadata_AsynchronousTest.UseRuntimeDataGeneration(testSessionId); + var metadata_ValueTaskAsynchronousTest = new global::TUnit.Core.TestMetadata + { + TestName = "ValueTaskAsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "ValueTaskAsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 17, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "ValueTaskAsynchronousTest", + GenericTypeCount = 0, + ReturnType = typeof(global::System.Threading.Tasks.ValueTask), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.ValueTask)), + Parameters = global::System.Array.Empty(), + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ValueTaskAsynchronousTest, + }; + metadata_ValueTaskAsynchronousTest.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_SynchronousTest, metadata_AsynchronousTest, metadata_ValueTaskAsynchronousTest }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -65,17 +143,47 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_SynchronousTest + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", + ClassName = "BasicTests", + MethodName = "AsynchronousTest", + FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", + FilePath = @"", + LineNumber = 11, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_AsynchronousTest + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + ClassName = "BasicTests", + MethodName = "ValueTaskAsynchronousTest", + FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + FilePath = @"", + LineNumber = 17, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_ValueTaskAsynchronousTest }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ new global::TUnit.Core.TestAttribute() ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_SynchronousTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -87,44 +195,52 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata { - TestName = "AsynchronousTest", + TestName = "SynchronousTest", TestClassType = typeof(global::TUnit.TestProject.BasicTests), - TestMethodName = "AsynchronousTest", + TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 11, + LineNumber = 5, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.BasicTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "AsynchronousTest", + Name = "SynchronousTest", GenericTypeCount = 0, - ReturnType = typeof(global::System.Threading.Tasks.Task), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { @@ -138,63 +254,56 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SynchronousTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsynchronousTest(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", - ClassName = "BasicTests", - MethodName = "AsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", + TestName = "AsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "AsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", LineNumber = 11, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "AsynchronousTest", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsynchronousTest, }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_ValueTaskAsynchronousTest(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -202,7 +311,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "ValueTaskAsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -231,62 +340,12 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ValueTaskAsynchronousTest, }; 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.BasicTests.ValueTaskAsynchronousTest", - ClassName = "BasicTests", - MethodName = "ValueTaskAsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - FilePath = @"", - LineNumber = 17, - 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() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return instance.ValueTaskAsynchronousTest(); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_BasicTests__ClassHelper -{ internal static global::TUnit.TestProject.BasicTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.BasicTests(); @@ -294,8 +353,6 @@ internal static class TUnit_TestProject_BasicTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_AsynchronousTest_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_SynchronousTest_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests__TestSource()); } } 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 6ac3112a9b7..e8cb6263039 100644 --- a/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.DotNet9_0.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_BasicTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_SynchronousTest = new global::TUnit.Core.TestMetadata { TestName = "SynchronousTest", TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -44,11 +44,89 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SynchronousTest, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_SynchronousTest.UseRuntimeDataGeneration(testSessionId); + var metadata_AsynchronousTest = new global::TUnit.Core.TestMetadata + { + TestName = "AsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "AsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 11, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "AsynchronousTest", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsynchronousTest, + }; + metadata_AsynchronousTest.UseRuntimeDataGeneration(testSessionId); + var metadata_ValueTaskAsynchronousTest = new global::TUnit.Core.TestMetadata + { + TestName = "ValueTaskAsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "ValueTaskAsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 17, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "ValueTaskAsynchronousTest", + GenericTypeCount = 0, + ReturnType = typeof(global::System.Threading.Tasks.ValueTask), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.ValueTask)), + Parameters = global::System.Array.Empty(), + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ValueTaskAsynchronousTest, + }; + metadata_ValueTaskAsynchronousTest.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_SynchronousTest, metadata_AsynchronousTest, metadata_ValueTaskAsynchronousTest }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -65,17 +143,47 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_SynchronousTest + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", + ClassName = "BasicTests", + MethodName = "AsynchronousTest", + FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", + FilePath = @"", + LineNumber = 11, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_AsynchronousTest + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + ClassName = "BasicTests", + MethodName = "ValueTaskAsynchronousTest", + FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + FilePath = @"", + LineNumber = 17, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_ValueTaskAsynchronousTest }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ new global::TUnit.Core.TestAttribute() ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_SynchronousTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -87,44 +195,52 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata { - TestName = "AsynchronousTest", + TestName = "SynchronousTest", TestClassType = typeof(global::TUnit.TestProject.BasicTests), - TestMethodName = "AsynchronousTest", + TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 11, + LineNumber = 5, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.BasicTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "AsynchronousTest", + Name = "SynchronousTest", GenericTypeCount = 0, - ReturnType = typeof(global::System.Threading.Tasks.Task), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { @@ -138,63 +254,56 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SynchronousTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsynchronousTest(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", - ClassName = "BasicTests", - MethodName = "AsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", + TestName = "AsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "AsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", LineNumber = 11, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "AsynchronousTest", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsynchronousTest, }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_ValueTaskAsynchronousTest(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -202,7 +311,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "ValueTaskAsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -231,62 +340,12 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ValueTaskAsynchronousTest, }; 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.BasicTests.ValueTaskAsynchronousTest", - ClassName = "BasicTests", - MethodName = "ValueTaskAsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - FilePath = @"", - LineNumber = 17, - 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() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return instance.ValueTaskAsynchronousTest(); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_BasicTests__ClassHelper -{ internal static global::TUnit.TestProject.BasicTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.BasicTests(); @@ -294,8 +353,6 @@ internal static class TUnit_TestProject_BasicTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_AsynchronousTest_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_SynchronousTest_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests__TestSource()); } } 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 abf00eea2c1..f717b59d6f0 100644 --- a/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.Net4_7.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/BasicTests.Test.Net4_7.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_BasicTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_SynchronousTest = new global::TUnit.Core.TestMetadata { TestName = "SynchronousTest", TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -44,11 +44,89 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SynchronousTest, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_SynchronousTest.UseRuntimeDataGeneration(testSessionId); + var metadata_AsynchronousTest = new global::TUnit.Core.TestMetadata + { + TestName = "AsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "AsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 11, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "AsynchronousTest", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsynchronousTest, + }; + metadata_AsynchronousTest.UseRuntimeDataGeneration(testSessionId); + var metadata_ValueTaskAsynchronousTest = new global::TUnit.Core.TestMetadata + { + TestName = "ValueTaskAsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "ValueTaskAsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 17, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "ValueTaskAsynchronousTest", + GenericTypeCount = 0, + ReturnType = typeof(global::System.Threading.Tasks.ValueTask), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.ValueTask)), + Parameters = global::System.Array.Empty(), + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ValueTaskAsynchronousTest, + }; + metadata_ValueTaskAsynchronousTest.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_SynchronousTest, metadata_AsynchronousTest, metadata_ValueTaskAsynchronousTest }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -65,17 +143,47 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_SynchronousTest + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", + ClassName = "BasicTests", + MethodName = "AsynchronousTest", + FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", + FilePath = @"", + LineNumber = 11, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_AsynchronousTest + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + ClassName = "BasicTests", + MethodName = "ValueTaskAsynchronousTest", + FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + FilePath = @"", + LineNumber = 17, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_ValueTaskAsynchronousTest }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ new global::TUnit.Core.TestAttribute() ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_SynchronousTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -87,44 +195,52 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata { - TestName = "AsynchronousTest", + TestName = "SynchronousTest", TestClassType = typeof(global::TUnit.TestProject.BasicTests), - TestMethodName = "AsynchronousTest", + TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 11, + LineNumber = 5, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.BasicTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "AsynchronousTest", + Name = "SynchronousTest", GenericTypeCount = 0, - ReturnType = typeof(global::System.Threading.Tasks.Task), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { @@ -138,63 +254,56 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SynchronousTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsynchronousTest(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", - ClassName = "BasicTests", - MethodName = "AsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", + TestName = "AsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "AsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", LineNumber = 11, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "AsynchronousTest", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsynchronousTest, }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_ValueTaskAsynchronousTest(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -202,7 +311,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "ValueTaskAsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -231,62 +340,12 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ValueTaskAsynchronousTest, }; 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.BasicTests.ValueTaskAsynchronousTest", - ClassName = "BasicTests", - MethodName = "ValueTaskAsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - FilePath = @"", - LineNumber = 17, - 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() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return instance.ValueTaskAsynchronousTest(); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_BasicTests__ClassHelper -{ internal static global::TUnit.TestProject.BasicTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.BasicTests(); @@ -294,8 +353,6 @@ internal static class TUnit_TestProject_BasicTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_AsynchronousTest_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_SynchronousTest_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/BeforeAllTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/BeforeAllTests.Test.verified.txt index 0b533e9d1f1..33e043fa016 100644 --- a/TUnit.Core.SourceGenerator.Tests/BeforeAllTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/BeforeAllTests.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BeforeTests_SetupTests_Test1_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_BeforeTests_SetupTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_Test1 = new global::TUnit.Core.TestMetadata { TestName = "Test1", TestClassType = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), TestMethodName = "Test1", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -44,11 +44,50 @@ internal sealed class TUnit_TestProject_BeforeTests_SetupTests_Test1_TestSource Parent = null }) }, - InstanceFactory = TUnit_TestProject_BeforeTests_SetupTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test1, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_Test1.UseRuntimeDataGeneration(testSessionId); + var metadata_Test2 = new global::TUnit.Core.TestMetadata + { + TestName = "Test2", + TestClassType = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TestMethodName = "Test2", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 104, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), + Name = "Test2", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test2, + }; + metadata_Test2.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_Test1, metadata_Test2 }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -65,17 +104,32 @@ internal sealed class TUnit_TestProject_BeforeTests_SetupTests_Test1_TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_Test1 + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.BeforeTests.SetupTests.Test2", + ClassName = "SetupTests", + MethodName = "Test2", + FullyQualifiedName = "TUnit.TestProject.BeforeTests.SetupTests.Test2", + FilePath = @"", + LineNumber = 104, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Test2 }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ new global::TUnit.Core.TestAttribute() ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BeforeTests.SetupTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_Test1(global::TUnit.TestProject.BeforeTests.SetupTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -86,41 +140,38 @@ internal sealed class TUnit_TestProject_BeforeTests_SetupTests_Test1_TestSource return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BeforeTests_SetupTests_Test2_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata { - TestName = "Test2", + TestName = "Test1", TestClassType = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), - TestMethodName = "Test2", + TestMethodName = "Test1", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 104, + LineNumber = 98, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), - Name = "Test2", + Name = "Test1", GenericTypeCount = 0, ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), @@ -137,62 +188,55 @@ internal sealed class TUnit_TestProject_BeforeTests_SetupTests_Test2_TestSource Parent = null }) }, - InstanceFactory = TUnit_TestProject_BeforeTests_SetupTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test1, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test2(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.BeforeTests.SetupTests.Test2", - ClassName = "SetupTests", - MethodName = "Test2", - FullyQualifiedName = "TUnit.TestProject.BeforeTests.SetupTests.Test2", + TestName = "Test2", + TestClassType = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TestMethodName = "Test2", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", LineNumber = 104, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), + Name = "Test2", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test2, }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BeforeTests.SetupTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.Test2()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_BeforeTests_SetupTests__ClassHelper -{ internal static global::TUnit.TestProject.BeforeTests.SetupTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.BeforeTests.SetupTests(); @@ -200,7 +244,6 @@ internal static class TUnit_TestProject_BeforeTests_SetupTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BeforeTests.SetupTests), new TUnit_TestProject_BeforeTests_SetupTests_Test1_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BeforeTests.SetupTests), new TUnit_TestProject_BeforeTests_SetupTests_Test2_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BeforeTests.SetupTests), new TUnit_TestProject_BeforeTests_SetupTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/BeforeTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/BeforeTests.Test.verified.txt index 0b533e9d1f1..33e043fa016 100644 --- a/TUnit.Core.SourceGenerator.Tests/BeforeTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/BeforeTests.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BeforeTests_SetupTests_Test1_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_BeforeTests_SetupTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_Test1 = new global::TUnit.Core.TestMetadata { TestName = "Test1", TestClassType = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), TestMethodName = "Test1", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -44,11 +44,50 @@ internal sealed class TUnit_TestProject_BeforeTests_SetupTests_Test1_TestSource Parent = null }) }, - InstanceFactory = TUnit_TestProject_BeforeTests_SetupTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test1, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_Test1.UseRuntimeDataGeneration(testSessionId); + var metadata_Test2 = new global::TUnit.Core.TestMetadata + { + TestName = "Test2", + TestClassType = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TestMethodName = "Test2", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 104, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), + Name = "Test2", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test2, + }; + metadata_Test2.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_Test1, metadata_Test2 }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -65,17 +104,32 @@ internal sealed class TUnit_TestProject_BeforeTests_SetupTests_Test1_TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_Test1 + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.BeforeTests.SetupTests.Test2", + ClassName = "SetupTests", + MethodName = "Test2", + FullyQualifiedName = "TUnit.TestProject.BeforeTests.SetupTests.Test2", + FilePath = @"", + LineNumber = 104, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Test2 }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ new global::TUnit.Core.TestAttribute() ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BeforeTests.SetupTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_Test1(global::TUnit.TestProject.BeforeTests.SetupTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -86,41 +140,38 @@ internal sealed class TUnit_TestProject_BeforeTests_SetupTests_Test1_TestSource return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BeforeTests_SetupTests_Test2_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata { - TestName = "Test2", + TestName = "Test1", TestClassType = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), - TestMethodName = "Test2", + TestMethodName = "Test1", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 104, + LineNumber = 98, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), - Name = "Test2", + Name = "Test1", GenericTypeCount = 0, ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), @@ -137,62 +188,55 @@ internal sealed class TUnit_TestProject_BeforeTests_SetupTests_Test2_TestSource Parent = null }) }, - InstanceFactory = TUnit_TestProject_BeforeTests_SetupTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test1, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test2(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.BeforeTests.SetupTests.Test2", - ClassName = "SetupTests", - MethodName = "Test2", - FullyQualifiedName = "TUnit.TestProject.BeforeTests.SetupTests.Test2", + TestName = "Test2", + TestClassType = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TestMethodName = "Test2", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", LineNumber = 104, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BeforeTests.SetupTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BeforeTests.SetupTests)), + Name = "Test2", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test2, }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BeforeTests.SetupTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.Test2()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_BeforeTests_SetupTests__ClassHelper -{ internal static global::TUnit.TestProject.BeforeTests.SetupTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.BeforeTests.SetupTests(); @@ -200,7 +244,6 @@ internal static class TUnit_TestProject_BeforeTests_SetupTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BeforeTests.SetupTests), new TUnit_TestProject_BeforeTests_SetupTests_Test1_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BeforeTests.SetupTests), new TUnit_TestProject_BeforeTests_SetupTests_Test2_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BeforeTests.SetupTests), new TUnit_TestProject_BeforeTests_SetupTests__TestSource()); } } 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 63d613a210e..dc3e835ed46 100644 --- a/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet10_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet10_0.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_Bugs__2971_Tests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_SimpleTest = new global::TUnit.Core.TestMetadata { TestName = "SimpleTest", TestClassType = typeof(global::TUnit.TestProject.Bugs._2971.Tests), TestMethodName = "SimpleTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -44,11 +44,11 @@ internal sealed class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_Bugs__2971_Tests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SimpleTest, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_SimpleTest.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_SimpleTest }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -65,10 +65,10 @@ internal sealed class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource : HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_SimpleTest }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -76,7 +76,7 @@ internal sealed class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource : new global::TUnit.TestProject.Bugs._2971.SomeAttribute(typeof(global::System.Nullable<>)) ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._2971.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_SimpleTest(global::TUnit.TestProject.Bugs._2971.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -88,20 +88,49 @@ internal sealed class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource : return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_Bugs__2971_Tests__ClassHelper -{ + private static global::System.Collections.Generic.IReadOnlyList __Materialize_SimpleTest(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "SimpleTest", + TestClassType = typeof(global::TUnit.TestProject.Bugs._2971.Tests), + TestMethodName = "SimpleTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 19, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._2971.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2971.Tests)), + Name = "SimpleTest", + 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._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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SimpleTest, + }; + metadata.UseRuntimeDataGeneration(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(); @@ -109,6 +138,6 @@ internal static class TUnit_TestProject_Bugs__2971_Tests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._2971.Tests), new TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._2971.Tests), new TUnit_TestProject_Bugs__2971_Tests__TestSource()); } } 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 63d613a210e..dc3e835ed46 100644 --- a/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet8_0.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_Bugs__2971_Tests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_SimpleTest = new global::TUnit.Core.TestMetadata { TestName = "SimpleTest", TestClassType = typeof(global::TUnit.TestProject.Bugs._2971.Tests), TestMethodName = "SimpleTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -44,11 +44,11 @@ internal sealed class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_Bugs__2971_Tests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SimpleTest, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_SimpleTest.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_SimpleTest }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -65,10 +65,10 @@ internal sealed class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource : HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_SimpleTest }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -76,7 +76,7 @@ internal sealed class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource : new global::TUnit.TestProject.Bugs._2971.SomeAttribute(typeof(global::System.Nullable<>)) ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._2971.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_SimpleTest(global::TUnit.TestProject.Bugs._2971.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -88,20 +88,49 @@ internal sealed class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource : return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_Bugs__2971_Tests__ClassHelper -{ + private static global::System.Collections.Generic.IReadOnlyList __Materialize_SimpleTest(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "SimpleTest", + TestClassType = typeof(global::TUnit.TestProject.Bugs._2971.Tests), + TestMethodName = "SimpleTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 19, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._2971.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2971.Tests)), + Name = "SimpleTest", + 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._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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SimpleTest, + }; + metadata.UseRuntimeDataGeneration(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(); @@ -109,6 +138,6 @@ internal static class TUnit_TestProject_Bugs__2971_Tests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._2971.Tests), new TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._2971.Tests), new TUnit_TestProject_Bugs__2971_Tests__TestSource()); } } 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 63d613a210e..dc3e835ed46 100644 --- a/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.DotNet9_0.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_Bugs__2971_Tests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_SimpleTest = new global::TUnit.Core.TestMetadata { TestName = "SimpleTest", TestClassType = typeof(global::TUnit.TestProject.Bugs._2971.Tests), TestMethodName = "SimpleTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -44,11 +44,11 @@ internal sealed class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_Bugs__2971_Tests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SimpleTest, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_SimpleTest.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_SimpleTest }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -65,10 +65,10 @@ internal sealed class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource : HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_SimpleTest }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -76,7 +76,7 @@ internal sealed class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource : new global::TUnit.TestProject.Bugs._2971.SomeAttribute(typeof(global::System.Nullable<>)) ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._2971.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_SimpleTest(global::TUnit.TestProject.Bugs._2971.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -88,20 +88,49 @@ internal sealed class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource : return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_Bugs__2971_Tests__ClassHelper -{ + private static global::System.Collections.Generic.IReadOnlyList __Materialize_SimpleTest(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "SimpleTest", + TestClassType = typeof(global::TUnit.TestProject.Bugs._2971.Tests), + TestMethodName = "SimpleTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 19, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._2971.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2971.Tests)), + Name = "SimpleTest", + 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._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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SimpleTest, + }; + metadata.UseRuntimeDataGeneration(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(); @@ -109,6 +138,6 @@ internal static class TUnit_TestProject_Bugs__2971_Tests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._2971.Tests), new TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._2971.Tests), new TUnit_TestProject_Bugs__2971_Tests__TestSource()); } } 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 c16b9fc4e11..f22dffb1c71 100644 --- a/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.Net4_7.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Bugs2971NullableTypeTest.Test.Net4_7.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_Bugs__2971_Tests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_SimpleTest = new global::TUnit.Core.TestMetadata { TestName = "SimpleTest", TestClassType = typeof(global::TUnit.TestProject.Bugs._2971.Tests), TestMethodName = "SimpleTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -44,11 +44,11 @@ internal sealed class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_Bugs__2971_Tests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SimpleTest, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_SimpleTest.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_SimpleTest }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -65,10 +65,10 @@ internal sealed class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource : HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_SimpleTest }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -76,7 +76,7 @@ internal sealed class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource : new global::TUnit.TestProject.Bugs._2971.SomeAttribute(typeof(global::System.Nullable<>)) ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._2971.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_SimpleTest(global::TUnit.TestProject.Bugs._2971.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -88,20 +88,49 @@ internal sealed class TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource : return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_Bugs__2971_Tests__ClassHelper -{ + private static global::System.Collections.Generic.IReadOnlyList __Materialize_SimpleTest(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "SimpleTest", + TestClassType = typeof(global::TUnit.TestProject.Bugs._2971.Tests), + TestMethodName = "SimpleTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 19, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._2971.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2971.Tests)), + Name = "SimpleTest", + 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._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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SimpleTest, + }; + metadata.UseRuntimeDataGeneration(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(); @@ -109,6 +138,6 @@ internal static class TUnit_TestProject_Bugs__2971_Tests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._2971.Tests), new TUnit_TestProject_Bugs__2971_Tests_SimpleTest_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._2971.Tests), new TUnit_TestProject_Bugs__2971_Tests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/ClassAndMethodArgumentsTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassAndMethodArgumentsTests.Test.verified.txt index ac151f5a5e8..26cfabe953d 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassAndMethodArgumentsTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ClassAndMethodArgumentsTests.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_ClassAndMethodArgumentsTests_Simple_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_ClassAndMethodArgumentsTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_Simple = new global::TUnit.Core.TestMetadata { TestName = "Simple", TestClassType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), TestMethodName = "Simple", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] { @@ -57,73 +57,17 @@ internal sealed class TUnit_TestProject_ClassAndMethodArgumentsTests_Simple_Test Parent = null }) }, - InstanceFactory = TUnit_TestProject_ClassAndMethodArgumentsTests__ClassHelper.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.ClassAndMethodArgumentsTests.Simple", - ClassName = "ClassAndMethodArgumentsTests", - MethodName = "Simple", - FullyQualifiedName = "TUnit.TestProject.ClassAndMethodArgumentsTests.Simple", - FilePath = @"", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Simple, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.ArgumentsAttribute("1"), - new global::TUnit.Core.ArgumentsAttribute("2") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassAndMethodArgumentsTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.Simple()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_ClassAndMethodArgumentsTests_WithMethodLevel__string_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_Simple.UseRuntimeDataGeneration(testSessionId); + var metadata_WithMethodLevel__string = new global::TUnit.Core.TestMetadata { TestName = "WithMethodLevel", TestClassType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), TestMethodName = "WithMethodLevel", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("3"), @@ -178,14 +122,94 @@ internal sealed class TUnit_TestProject_ClassAndMethodArgumentsTests_WithMethodL Parent = null }) }, - InstanceFactory = TUnit_TestProject_ClassAndMethodArgumentsTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_WithMethodLevel__string, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_WithMethodLevel__string.UseRuntimeDataGeneration(testSessionId); + var metadata_IgnoreParameters__string = new global::TUnit.Core.TestMetadata + { + TestName = "IgnoreParameters", + TestClassType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), + TestMethodName = "IgnoreParameters", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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"), + }, + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 16, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests)), + Name = "IgnoreParameters", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "arg2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("IgnoreParameters", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassAndMethodArgumentsTests", 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "arg1", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetConstructor(new global::System.Type[] { typeof(string) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_IgnoreParameters__string, + }; + metadata_IgnoreParameters__string.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_Simple, metadata_WithMethodLevel__string, metadata_IgnoreParameters__string }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.ClassAndMethodArgumentsTests.Simple", + ClassName = "ClassAndMethodArgumentsTests", + MethodName = "Simple", + FullyQualifiedName = "TUnit.TestProject.ClassAndMethodArgumentsTests.Simple", + FilePath = @"", + LineNumber = 8, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Simple + }; yield return new global::TUnit.Core.TestDescriptor { TestId = "TUnit.TestProject.ClassAndMethodArgumentsTests.WithMethodLevel", @@ -199,10 +223,25 @@ internal sealed class TUnit_TestProject_ClassAndMethodArgumentsTests_WithMethodL HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_WithMethodLevel__string + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.ClassAndMethodArgumentsTests.IgnoreParameters", + ClassName = "ClassAndMethodArgumentsTests", + MethodName = "IgnoreParameters", + FullyQualifiedName = "TUnit.TestProject.ClassAndMethodArgumentsTests.IgnoreParameters", + FilePath = @"", + LineNumber = 16, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_IgnoreParameters__string }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -211,7 +250,18 @@ internal sealed class TUnit_TestProject_ClassAndMethodArgumentsTests_WithMethodL new global::TUnit.Core.ArgumentsAttribute("2") ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassAndMethodArgumentsTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + 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 { @@ -230,29 +280,90 @@ internal sealed class TUnit_TestProject_ClassAndMethodArgumentsTests_WithMethodL return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_ClassAndMethodArgumentsTests_IgnoreParameters__string_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata { - TestName = "IgnoreParameters", + TestName = "Simple", TestClassType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), - TestMethodName = "IgnoreParameters", + TestMethodName = "Simple", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute("1"), + new global::TUnit.Core.ArgumentsAttribute("2"), + }, + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 8, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests)), + Name = "Simple", + 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.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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "arg1", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetConstructor(new global::System.Type[] { typeof(string) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Simple, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_WithMethodLevel__string(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "WithMethodLevel", + TestClassType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), + TestMethodName = "WithMethodLevel", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("3"), @@ -267,12 +378,12 @@ internal sealed class TUnit_TestProject_ClassAndMethodArgumentsTests_IgnoreParam PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 16, + LineNumber = 11, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests)), - Name = "IgnoreParameters", + Name = "WithMethodLevel", GenericTypeCount = 0, ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), @@ -283,7 +394,7 @@ internal sealed class TUnit_TestProject_ClassAndMethodArgumentsTests_IgnoreParam Name = "arg2", TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("IgnoreParameters", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] + ReflectionInfo = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("WithMethodLevel", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassAndMethodArgumentsTests", new global::TUnit.Core.ClassMetadata @@ -307,72 +418,81 @@ internal sealed class TUnit_TestProject_ClassAndMethodArgumentsTests_IgnoreParam Parent = null }) }, - InstanceFactory = TUnit_TestProject_ClassAndMethodArgumentsTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_WithMethodLevel__string, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_IgnoreParameters__string(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.ClassAndMethodArgumentsTests.IgnoreParameters", - ClassName = "ClassAndMethodArgumentsTests", - MethodName = "IgnoreParameters", - FullyQualifiedName = "TUnit.TestProject.ClassAndMethodArgumentsTests.IgnoreParameters", + TestName = "IgnoreParameters", + TestClassType = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), + TestMethodName = "IgnoreParameters", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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"), + }, + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", LineNumber = 16, - 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.Core.ArgumentsAttribute("1"), - new global::TUnit.Core.ArgumentsAttribute("2") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassAndMethodArgumentsTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) + MethodMetadata = new global::TUnit.Core.MethodMetadata { - case 1: + Type = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests)), + Name = "IgnoreParameters", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) { - return new global::System.Threading.Tasks.ValueTask(instance.IgnoreParameters(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + Name = "arg2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetMethod("IgnoreParameters", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } + }, + Class = 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "arg1", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests).GetConstructor(new global::System.Type[] { typeof(string) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_IgnoreParameters__string, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_ClassAndMethodArgumentsTests__ClassHelper -{ 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])); @@ -380,8 +500,6 @@ internal static class TUnit_TestProject_ClassAndMethodArgumentsTests__ClassHelpe [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), new TUnit_TestProject_ClassAndMethodArgumentsTests_IgnoreParameters__string_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), new TUnit_TestProject_ClassAndMethodArgumentsTests_Simple_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), new TUnit_TestProject_ClassAndMethodArgumentsTests_WithMethodLevel__string_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ClassAndMethodArgumentsTests), new TUnit_TestProject_ClassAndMethodArgumentsTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/ClassConstructorTest.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassConstructorTest.Test.verified.txt index ef65d905521..63bdc04b979 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassConstructorTest.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ClassConstructorTest.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_ClassConstructorTest_Test_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_ClassConstructorTest__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_Test = new global::TUnit.Core.TestMetadata { TestName = "Test", TestClassType = typeof(global::TUnit.TestProject.ClassConstructorTest), TestMethodName = "Test", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -66,11 +66,11 @@ internal sealed class TUnit_TestProject_ClassConstructorTest_Test_TestSource : g Parent = null }) }, - InstanceFactory = TUnit_TestProject_ClassConstructorTest__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_Test.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_Test }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -87,10 +87,10 @@ internal sealed class TUnit_TestProject_ClassConstructorTest_Test_TestSource : g HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_Test }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -98,7 +98,7 @@ internal sealed class TUnit_TestProject_ClassConstructorTest_Test_TestSource : g new global::TUnit.Core.ClassConstructorAttribute() ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassConstructorTest instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_Test(global::TUnit.TestProject.ClassConstructorTest instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -110,20 +110,71 @@ internal sealed class TUnit_TestProject_ClassConstructorTest_Test_TestSource : g return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_ClassConstructorTest__ClassHelper -{ + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "Test", + TestClassType = typeof(global::TUnit.TestProject.ClassConstructorTest), + TestMethodName = "Test", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 + { + Type = typeof(global::TUnit.TestProject.ClassConstructorTest), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassConstructorTest)), + Name = "Test", + 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.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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.DummyReferenceTypeClass)) + { + Name = "dummyReferenceTypeClass", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DummyReferenceTypeClass)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ClassConstructorTest).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.DummyReferenceTypeClass) })!.GetParameters()[0] + } + }, + Properties = new global::TUnit.Core.PropertyMetadata[] + { + new global::TUnit.Core.PropertyMetadata + { + ReflectionInfo = typeof(global::TUnit.TestProject.ClassConstructorTest).GetProperty("DummyReferenceTypeClass"), + Type = typeof(global::TUnit.TestProject.DummyReferenceTypeClass), + Name = "DummyReferenceTypeClass", + IsStatic = false, + IsNullable = false, + Getter = o => ((global::TUnit.TestProject.ClassConstructorTest)o).DummyReferenceTypeClass, + ClassMetadata = null!, + ContainingTypeMetadata = null! + } + }, + Parent = null + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test, + }; + metadata.UseRuntimeDataGeneration(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 @@ -132,6 +183,6 @@ internal static class TUnit_TestProject_ClassConstructorTest__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ClassConstructorTest), new TUnit_TestProject_ClassConstructorTest_Test_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ClassConstructorTest), new TUnit_TestProject_ClassConstructorTest__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests.Test.verified.txt index 27f82beb15f..6b48895e180 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_DataSource_Class__SomeAsyncDisposableClass_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_DataSource_Class__SomeAsyncDisposableClass = new global::TUnit.Core.TestMetadata { TestName = "DataSource_Class", TestClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), TestMethodName = "DataSource_Class", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ClassDataSourceAttribute(), @@ -56,81 +56,17 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_DataSource_Cl Parent = null }) }, - InstanceFactory = TUnit_TestProject_ClassDataSourceDrivenTests__ClassHelper.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.ClassDataSourceDrivenTests.DataSource_Class", - ClassName = "ClassDataSourceDrivenTests", - MethodName = "DataSource_Class", - FullyQualifiedName = "TUnit.TestProject.ClassDataSourceDrivenTests.DataSource_Class", - FilePath = @"", - LineNumber = 9, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Class__SomeAsyncDisposableClass, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Class(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_DataSource_Class_Generic__SomeAsyncDisposableClass_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_Class__SomeAsyncDisposableClass.UseRuntimeDataGeneration(testSessionId); + var metadata_DataSource_Class_Generic__SomeAsyncDisposableClass = new global::TUnit.Core.TestMetadata { TestName = "DataSource_Class_Generic", TestClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), TestMethodName = "DataSource_Class_Generic", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ClassDataSourceAttribute(), @@ -171,81 +107,17 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_DataSource_Cl Parent = null }) }, - InstanceFactory = TUnit_TestProject_ClassDataSourceDrivenTests__ClassHelper.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.ClassDataSourceDrivenTests.DataSource_Class_Generic", - ClassName = "ClassDataSourceDrivenTests", - MethodName = "DataSource_Class_Generic", - FullyQualifiedName = "TUnit.TestProject.ClassDataSourceDrivenTests.DataSource_Class_Generic", - FilePath = @"", - LineNumber = 16, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Class_Generic__SomeAsyncDisposableClass, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Class_Generic(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized_With_1_ClassDataSource__Ini_01E5B4B7_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_Class_Generic__SomeAsyncDisposableClass.UseRuntimeDataGeneration(testSessionId); + var metadata_IsInitialized_With_1_ClassDataSource__InitializableClass = new global::TUnit.Core.TestMetadata { TestName = "IsInitialized_With_1_ClassDataSource", TestClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), TestMethodName = "IsInitialized_With_1_ClassDataSource", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ClassDataSourceAttribute(), @@ -286,72 +158,703 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized Parent = null }) }, - InstanceFactory = TUnit_TestProject_ClassDataSourceDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_IsInitialized_With_1_ClassDataSource__InitializableClass, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor + metadata_IsInitialized_With_1_ClassDataSource__InitializableClass.UseRuntimeDataGeneration(testSessionId); + var metadata_IsInitialized_With_2_ClassDataSources__InitializableClass_InitializableClass = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_1_ClassDataSource", - ClassName = "ClassDataSourceDrivenTests", - MethodName = "IsInitialized_With_1_ClassDataSource", - FullyQualifiedName = "TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_1_ClassDataSource", + TestName = "IsInitialized_With_2_ClassDataSources", + TestClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), + TestMethodName = "IsInitialized_With_2_ClassDataSources", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ClassDataSourceAttribute(), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", - LineNumber = 23, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + LineNumber = 30, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests)), + Name = "IsInitialized_With_2_ClassDataSources", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)) + { + Name = "class1", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_2_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)) + { + Name = "class2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_2_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_IsInitialized_With_2_ClassDataSources__InitializableClass_InitializableClass, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try + metadata_IsInitialized_With_2_ClassDataSources__InitializableClass_InitializableClass.UseRuntimeDataGeneration(testSessionId); + var metadata_IsInitialized_With_3_ClassDataSources__InitializableClass_InitializableClass_InitializableClass = new global::TUnit.Core.TestMetadata { - switch (args.Length) + TestName = "IsInitialized_With_3_ClassDataSources", + TestClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), + TestMethodName = "IsInitialized_With_3_ClassDataSources", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] { - case 1: + new global::TUnit.Core.ClassDataSourceAttribute(), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 38, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests)), + Name = "IsInitialized_With_3_ClassDataSources", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)) { - return new global::System.Threading.Tasks.ValueTask(instance.IsInitialized_With_1_ClassDataSource(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + Name = "class1", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_3_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)) + { + Name = "class2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_3_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass) }, null)!.GetParameters()[1] + }, + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)) + { + Name = "class3", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_3_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass) }, null)!.GetParameters()[2] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_IsInitialized_With_3_ClassDataSources__InitializableClass_InitializableClass_InitializableClass, + }; + metadata_IsInitialized_With_3_ClassDataSources__InitializableClass_InitializableClass_InitializableClass.UseRuntimeDataGeneration(testSessionId); + var metadata_IsInitialized_With_4_ClassDataSources__InitializableClass_InitializableClass_InitializableClass_InitializableClass = new global::TUnit.Core.TestMetadata + { + TestName = "IsInitialized_With_4_ClassDataSources", + TestClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), + TestMethodName = "IsInitialized_With_4_ClassDataSources", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ClassDataSourceAttribute(), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 47, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests)), + Name = "IsInitialized_With_4_ClassDataSources", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)) + { + Name = "class1", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_4_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)) + { + Name = "class2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_4_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass) }, null)!.GetParameters()[1] + }, + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)) + { + Name = "class3", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_4_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass) }, null)!.GetParameters()[2] + }, + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)) + { + Name = "class4", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_4_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass) }, null)!.GetParameters()[3] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_IsInitialized_With_4_ClassDataSources__InitializableClass_InitializableClass_InitializableClass_InitializableClass, + }; + metadata_IsInitialized_With_4_ClassDataSources__InitializableClass_InitializableClass_InitializableClass_InitializableClass.UseRuntimeDataGeneration(testSessionId); + var metadata_IsInitialized_With_5_ClassDataSources__InitializableClass_InitializableClass_InitializableClass_InitializableClass_InitializableClass = new global::TUnit.Core.TestMetadata + { + TestName = "IsInitialized_With_5_ClassDataSources", + TestClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), + TestMethodName = "IsInitialized_With_5_ClassDataSources", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ClassDataSourceAttribute(), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 57, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests)), + Name = "IsInitialized_With_5_ClassDataSources", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)) + { + Name = "class1", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_5_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)) + { + Name = "class2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_5_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass) }, null)!.GetParameters()[1] + }, + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)) + { + Name = "class3", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_5_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass) }, null)!.GetParameters()[2] + }, + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)) + { + Name = "class4", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_5_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass) }, null)!.GetParameters()[3] + }, + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)) + { + Name = "class5", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_5_ClassDataSources", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass), typeof(global::TUnit.TestProject.Library.Models.InitializableClass) }, null)!.GetParameters()[4] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_IsInitialized_With_5_ClassDataSources__InitializableClass_InitializableClass_InitializableClass_InitializableClass_InitializableClass, + }; + metadata_IsInitialized_With_5_ClassDataSources__InitializableClass_InitializableClass_InitializableClass_InitializableClass_InitializableClass.UseRuntimeDataGeneration(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 }; + } + public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + { + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.ClassDataSourceDrivenTests.DataSource_Class", + ClassName = "ClassDataSourceDrivenTests", + MethodName = "DataSource_Class", + FullyQualifiedName = "TUnit.TestProject.ClassDataSourceDrivenTests.DataSource_Class", + FilePath = @"", + LineNumber = 9, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_DataSource_Class__SomeAsyncDisposableClass + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.ClassDataSourceDrivenTests.DataSource_Class_Generic", + ClassName = "ClassDataSourceDrivenTests", + MethodName = "DataSource_Class_Generic", + FullyQualifiedName = "TUnit.TestProject.ClassDataSourceDrivenTests.DataSource_Class_Generic", + FilePath = @"", + LineNumber = 16, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_DataSource_Class_Generic__SomeAsyncDisposableClass + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_1_ClassDataSource", + ClassName = "ClassDataSourceDrivenTests", + MethodName = "IsInitialized_With_1_ClassDataSource", + FullyQualifiedName = "TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_1_ClassDataSource", + FilePath = @"", + LineNumber = 23, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_IsInitialized_With_1_ClassDataSource__InitializableClass + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_2_ClassDataSources", + ClassName = "ClassDataSourceDrivenTests", + MethodName = "IsInitialized_With_2_ClassDataSources", + FullyQualifiedName = "TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_2_ClassDataSources", + FilePath = @"", + LineNumber = 30, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_IsInitialized_With_2_ClassDataSources__InitializableClass_InitializableClass + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_3_ClassDataSources", + ClassName = "ClassDataSourceDrivenTests", + MethodName = "IsInitialized_With_3_ClassDataSources", + FullyQualifiedName = "TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_3_ClassDataSources", + FilePath = @"", + LineNumber = 38, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + 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 + { + TestId = "TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_4_ClassDataSources", + ClassName = "ClassDataSourceDrivenTests", + MethodName = "IsInitialized_With_4_ClassDataSources", + FullyQualifiedName = "TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_4_ClassDataSources", + FilePath = @"", + LineNumber = 47, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + 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 + { + TestId = "TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_5_ClassDataSources", + ClassName = "ClassDataSourceDrivenTests", + MethodName = "IsInitialized_With_5_ClassDataSources", + FullyQualifiedName = "TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_5_ClassDataSources", + FilePath = @"", + LineNumber = 57, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + 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 metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_Class", + TestClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), + TestMethodName = "DataSource_Class", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ClassDataSourceAttribute(), + }, + 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.ClassDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests)), + Name = "DataSource_Class", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("DataSource_Class", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Class__SomeAsyncDisposableClass, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Class_Generic__SomeAsyncDisposableClass(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_Class_Generic", + TestClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), + TestMethodName = "DataSource_Class_Generic", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ClassDataSourceAttribute(), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 16, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests)), + Name = "DataSource_Class_Generic", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("DataSource_Class_Generic", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Class_Generic__SomeAsyncDisposableClass, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_IsInitialized_With_1_ClassDataSource__InitializableClass(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "IsInitialized_With_1_ClassDataSource", + TestClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), + TestMethodName = "IsInitialized_With_1_ClassDataSource", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ClassDataSourceAttribute(), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 23, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests)), + Name = "IsInitialized_With_1_ClassDataSource", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)) + { + Name = "class1", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.InitializableClass)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests).GetMethod("IsInitialized_With_1_ClassDataSource", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.InitializableClass) }, null)!.GetParameters()[0] } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } + }, + Class = 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_IsInitialized_With_1_ClassDataSource__InitializableClass, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized_With_2_ClassDataSources__In_52B92153_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_IsInitialized_With_2_ClassDataSources__InitializableClass_InitializableClass(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -359,7 +862,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized TestClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), TestMethodName = "IsInitialized_With_2_ClassDataSources", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ClassDataSourceAttribute(), @@ -407,72 +910,13 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized Parent = null }) }, - InstanceFactory = TUnit_TestProject_ClassDataSourceDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_IsInitialized_With_2_ClassDataSources__InitializableClass_InitializableClass, }; 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.ClassDataSourceDrivenTests.IsInitialized_With_2_ClassDataSources", - ClassName = "ClassDataSourceDrivenTests", - MethodName = "IsInitialized_With_2_ClassDataSources", - FullyQualifiedName = "TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_2_ClassDataSources", - FilePath = @"", - LineNumber = 30, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.IsInitialized_With_2_ClassDataSources(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized_With_3_ClassDataSources__In_8432A34C_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_IsInitialized_With_3_ClassDataSources__InitializableClass_InitializableClass_InitializableClass(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -480,7 +924,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized TestClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), TestMethodName = "IsInitialized_With_3_ClassDataSources", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ClassDataSourceAttribute(), @@ -535,72 +979,13 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized Parent = null }) }, - InstanceFactory = TUnit_TestProject_ClassDataSourceDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_IsInitialized_With_3_ClassDataSources__InitializableClass_InitializableClass_InitializableClass, }; 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.ClassDataSourceDrivenTests.IsInitialized_With_3_ClassDataSources", - ClassName = "ClassDataSourceDrivenTests", - MethodName = "IsInitialized_With_3_ClassDataSources", - FullyQualifiedName = "TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_3_ClassDataSources", - FilePath = @"", - LineNumber = 38, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 3: - { - return new global::System.Threading.Tasks.ValueTask(instance.IsInitialized_With_3_ClassDataSources(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized_With_4_ClassDataSources__In_159CD9D1_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_IsInitialized_With_4_ClassDataSources__InitializableClass_InitializableClass_InitializableClass_InitializableClass(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -608,7 +993,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized TestClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), TestMethodName = "IsInitialized_With_4_ClassDataSources", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ClassDataSourceAttribute(), @@ -670,72 +1055,13 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized Parent = null }) }, - InstanceFactory = TUnit_TestProject_ClassDataSourceDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_IsInitialized_With_4_ClassDataSources__InitializableClass_InitializableClass_InitializableClass_InitializableClass, }; 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.ClassDataSourceDrivenTests.IsInitialized_With_4_ClassDataSources", - ClassName = "ClassDataSourceDrivenTests", - MethodName = "IsInitialized_With_4_ClassDataSources", - FullyQualifiedName = "TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_4_ClassDataSources", - FilePath = @"", - LineNumber = 47, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 4: - { - return new global::System.Threading.Tasks.ValueTask(instance.IsInitialized_With_4_ClassDataSources(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 4 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized_With_5_ClassDataSources__In_CB437346_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_IsInitialized_With_5_ClassDataSources__InitializableClass_InitializableClass_InitializableClass_InitializableClass_InitializableClass(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -743,7 +1069,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized TestClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), TestMethodName = "IsInitialized_With_5_ClassDataSources", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ClassDataSourceAttribute(), @@ -812,71 +1138,12 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized Parent = null }) }, - InstanceFactory = TUnit_TestProject_ClassDataSourceDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_IsInitialized_With_5_ClassDataSources__InitializableClass_InitializableClass_InitializableClass_InitializableClass_InitializableClass, }; 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.ClassDataSourceDrivenTests.IsInitialized_With_5_ClassDataSources", - ClassName = "ClassDataSourceDrivenTests", - MethodName = "IsInitialized_With_5_ClassDataSources", - FullyQualifiedName = "TUnit.TestProject.ClassDataSourceDrivenTests.IsInitialized_With_5_ClassDataSources", - FilePath = @"", - LineNumber = 57, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 5: - { - return new global::System.Threading.Tasks.ValueTask(instance.IsInitialized_With_5_ClassDataSources(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]), global::TUnit.Core.Helpers.CastHelper.Cast(args[4]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 5 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_ClassDataSourceDrivenTests__ClassHelper -{ internal static global::TUnit.TestProject.ClassDataSourceDrivenTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.ClassDataSourceDrivenTests(); @@ -884,12 +1151,6 @@ internal static class TUnit_TestProject_ClassDataSourceDrivenTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), new TUnit_TestProject_ClassDataSourceDrivenTests_DataSource_Class_Generic__SomeAsyncDisposableClass_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), new TUnit_TestProject_ClassDataSourceDrivenTests_DataSource_Class__SomeAsyncDisposableClass_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), new TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized_With_1_ClassDataSource__Ini_01E5B4B7_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), new TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized_With_2_ClassDataSources__In_52B92153_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), new TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized_With_3_ClassDataSources__In_8432A34C_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), new TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized_With_4_ClassDataSources__In_159CD9D1_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), new TUnit_TestProject_ClassDataSourceDrivenTests_IsInitialized_With_5_ClassDataSources__In_CB437346_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests), new TUnit_TestProject_ClassDataSourceDrivenTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests2.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests2.Test.verified.txt index 2b19ff177e4..7857a373a37 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests2.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTests2.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests2_Base_Derived1_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests2__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_Base_Derived1 = new global::TUnit.Core.TestMetadata { TestName = "Base_Derived1", TestClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2), TestMethodName = "Base_Derived1", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] { @@ -57,11 +57,63 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests2_Base_Derived Parent = null }) }, - InstanceFactory = TUnit_TestProject_ClassDataSourceDrivenTests2__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Base_Derived1, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_Base_Derived1.UseRuntimeDataGeneration(testSessionId); + var metadata_Base_Derived2 = new global::TUnit.Core.TestMetadata + { + TestName = "Base_Derived2", + TestClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2), + TestMethodName = "Base_Derived2", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ClassDataSourceAttribute(), + new global::TUnit.Core.ClassDataSourceAttribute(), + }, + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 18, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2)), + Name = "Base_Derived2", + 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.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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2.Base)) + { + Name = "base", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2.Base)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2.Base) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Base_Derived2, + }; + metadata_Base_Derived2.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_Base_Derived1, metadata_Base_Derived2 }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -78,10 +130,25 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests2_Base_Derived HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_Base_Derived1 + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.ClassDataSourceDrivenTests2.Base_Derived2", + ClassName = "ClassDataSourceDrivenTests2", + MethodName = "Base_Derived2", + FullyQualifiedName = "TUnit.TestProject.ClassDataSourceDrivenTests2.Base_Derived2", + FilePath = @"", + LineNumber = 18, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Base_Derived2 }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -91,7 +158,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests2_Base_Derived new global::TUnit.Core.ClassDataSourceAttribute() ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassDataSourceDrivenTests2 instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_Base_Derived1(global::TUnit.TestProject.ClassDataSourceDrivenTests2 instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -103,29 +170,27 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests2_Base_Derived return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests2_Base_Derived2_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata { - TestName = "Base_Derived2", + TestName = "Base_Derived1", TestClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2), - TestMethodName = "Base_Derived2", + TestMethodName = "Base_Derived1", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] { @@ -136,12 +201,12 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests2_Base_Derived PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 18, + LineNumber = 12, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2)), - Name = "Base_Derived2", + Name = "Base_Derived1", GenericTypeCount = 0, ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), @@ -167,66 +232,68 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTests2_Base_Derived Parent = null }) }, - InstanceFactory = TUnit_TestProject_ClassDataSourceDrivenTests2__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Base_Derived1, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Base_Derived2(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.ClassDataSourceDrivenTests2.Base_Derived2", - ClassName = "ClassDataSourceDrivenTests2", - MethodName = "Base_Derived2", - FullyQualifiedName = "TUnit.TestProject.ClassDataSourceDrivenTests2.Base_Derived2", + TestName = "Base_Derived2", + TestClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2), + TestMethodName = "Base_Derived2", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ClassDataSourceAttribute(), + new global::TUnit.Core.ClassDataSourceAttribute(), + }, + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", LineNumber = 18, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2)), + Name = "Base_Derived2", + 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.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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2.Base)) + { + Name = "base", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2.Base)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2.Base) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Base_Derived2, }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.ClassDataSourceAttribute(), - new global::TUnit.Core.ClassDataSourceAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassDataSourceDrivenTests2 instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - instance.Base_Derived2(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_ClassDataSourceDrivenTests2__ClassHelper -{ 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])); @@ -234,7 +301,6 @@ internal static class TUnit_TestProject_ClassDataSourceDrivenTests2__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2), new TUnit_TestProject_ClassDataSourceDrivenTests2_Base_Derived1_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2), new TUnit_TestProject_ClassDataSourceDrivenTests2_Base_Derived2_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTests2), new TUnit_TestProject_ClassDataSourceDrivenTests2__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTestsSharedKeyed.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTestsSharedKeyed.Test.verified.txt index 697959e9c72..2cad187293f 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTestsSharedKeyed.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ClassDataSourceDrivenTestsSharedKeyed.Test.verified.txt @@ -5,21 +5,21 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed_DataSource_Class__SomeAsyncDis_82F9A818_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_DataSource_Class__SomeAsyncDisposableClass = new global::TUnit.Core.TestMetadata { TestName = "DataSource_Class", TestClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed), TestMethodName = "DataSource_Class", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ClassDataSourceAttribute() -{Shared = global::TUnit.Core.SharedType.Keyed,Key = "🔑",}, + {Shared = global::TUnit.Core.SharedType.Keyed,Key = "🔑",}, }, ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -57,11 +57,63 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed_Da Parent = null }) }, - InstanceFactory = TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Class__SomeAsyncDisposableClass, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_DataSource_Class__SomeAsyncDisposableClass.UseRuntimeDataGeneration(testSessionId); + var metadata_DataSource_Class_Generic__SomeAsyncDisposableClass = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_Class_Generic", + TestClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed), + TestMethodName = "DataSource_Class_Generic", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ClassDataSourceAttribute() + {Shared = global::TUnit.Core.SharedType.Keyed,Key = "🔑",}, + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 16, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed)), + Name = "DataSource_Class_Generic", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed).GetMethod("DataSource_Class_Generic", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Class_Generic__SomeAsyncDisposableClass, + }; + metadata_DataSource_Class_Generic__SomeAsyncDisposableClass.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_DataSource_Class__SomeAsyncDisposableClass, metadata_DataSource_Class_Generic__SomeAsyncDisposableClass }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -78,10 +130,25 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed_Da HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_DataSource_Class__SomeAsyncDisposableClass + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed.DataSource_Class_Generic", + ClassName = "ClassDataSourceDrivenTestsSharedKeyed", + MethodName = "DataSource_Class_Generic", + FullyQualifiedName = "TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed.DataSource_Class_Generic", + FilePath = @"", + LineNumber = 16, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_DataSource_Class_Generic__SomeAsyncDisposableClass }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -89,7 +156,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed_Da new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Class__SomeAsyncDisposableClass(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -109,45 +176,51 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed_Da return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed_DataSource_Class_Generic__Some_7FC73642_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata { - TestName = "DataSource_Class_Generic", + TestName = "DataSource_Class", TestClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed), - TestMethodName = "DataSource_Class_Generic", + TestMethodName = "DataSource_Class", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ClassDataSourceAttribute() -{Shared = global::TUnit.Core.SharedType.Keyed,Key = "🔑",}, + {Shared = global::TUnit.Core.SharedType.Keyed,Key = "🔑",}, }, ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 16, + LineNumber = 9, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed)), - Name = "DataSource_Class_Generic", + Name = "DataSource_Class", GenericTypeCount = 0, ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), @@ -158,7 +231,7 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed_Da Name = "value", TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass)), IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed).GetMethod("DataSource_Class_Generic", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass) }, null)!.GetParameters()[0] + ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed).GetMethod("DataSource_Class", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass) }, null)!.GetParameters()[0] } }, Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed", new global::TUnit.Core.ClassMetadata @@ -173,72 +246,68 @@ internal sealed class TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed_Da Parent = null }) }, - InstanceFactory = TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Class__SomeAsyncDisposableClass, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Class_Generic__SomeAsyncDisposableClass(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed.DataSource_Class_Generic", - ClassName = "ClassDataSourceDrivenTestsSharedKeyed", - MethodName = "DataSource_Class_Generic", - FullyQualifiedName = "TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed.DataSource_Class_Generic", + TestName = "DataSource_Class_Generic", + TestClassType = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed), + TestMethodName = "DataSource_Class_Generic", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ClassDataSourceAttribute() + {Shared = global::TUnit.Core.SharedType.Keyed,Key = "🔑",}, + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", LineNumber = 16, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) + MethodMetadata = new global::TUnit.Core.MethodMetadata { - case 1: + Type = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed)), + Name = "DataSource_Class_Generic", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass)) { - instance.DataSource_Class_Generic(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed).GetMethod("DataSource_Class_Generic", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.Library.Models.SomeAsyncDisposableClass) }, null)!.GetParameters()[0] } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } + }, + Class = 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Class_Generic__SomeAsyncDisposableClass, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed__ClassHelper -{ internal static global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed(); @@ -246,7 +315,6 @@ internal static class TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed__C [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed), new TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed_DataSource_Class_Generic__Some_7FC73642_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed), new TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed_DataSource_Class__SomeAsyncDis_82F9A818_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ClassDataSourceDrivenTestsSharedKeyed), new TUnit_TestProject_ClassDataSourceDrivenTestsSharedKeyed__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.Test.verified.txt index 8b17b5324fd..252cb80c648 100644 --- a/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ClassTupleDataSourceDrivenTests.Test.verified.txt @@ -5,7 +5,7 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_ClassTupleDataSourceDrivenTests_DataSource_TupleMethod__int_string_bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_ClassTupleDataSourceDrivenTests__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")] @@ -19,13 +19,13 @@ internal sealed class TUnit_TestProject_ClassTupleDataSourceDrivenTests_DataSour #endif public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_DataSource_TupleMethod__int_string_bool = new global::TUnit.Core.TestMetadata { TestName = "DataSource_TupleMethod", TestClassType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests), TestMethodName = "DataSource_TupleMethod", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") @@ -334,11 +334,11 @@ internal sealed class TUnit_TestProject_ClassTupleDataSourceDrivenTests_DataSour Parent = null }) }, - InstanceFactory = TUnit_TestProject_ClassTupleDataSourceDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_TupleMethod__int_string_bool, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_DataSource_TupleMethod__int_string_bool.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_DataSource_TupleMethod__int_string_bool }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -355,10 +355,10 @@ internal sealed class TUnit_TestProject_ClassTupleDataSourceDrivenTests_DataSour HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_DataSource_TupleMethod__int_string_bool }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -368,7 +368,7 @@ internal sealed class TUnit_TestProject_ClassTupleDataSourceDrivenTests_DataSour new global::TUnit.Core.MethodDataSourceAttribute("NamedTupleMethod") ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + 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) { try { @@ -388,20 +388,329 @@ internal sealed class TUnit_TestProject_ClassTupleDataSourceDrivenTests_DataSour return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_ClassTupleDataSourceDrivenTests__ClassHelper -{ + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_TupleMethod__int_string_bool(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_TupleMethod", + TestClassType = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests), + TestMethodName = "DataSource_TupleMethod", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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("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[] + { + 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 + { + 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 => + { + 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(); + } + }, + }, + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 27, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests)), + Name = "DataSource_TupleMethod", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.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] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "value2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).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] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "value3", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string), typeof(bool) }, null)!.GetParameters()[2] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ClassTupleDataSourceDrivenTests", 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "value2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[1] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "value3", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[2] + } + }, + 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_TupleMethod__int_string_bool, + }; + metadata.UseRuntimeDataGeneration(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])) @@ -415,6 +724,6 @@ internal static class TUnit_TestProject_ClassTupleDataSourceDrivenTests__ClassHe [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests), new TUnit_TestProject_ClassTupleDataSourceDrivenTests_DataSource_TupleMethod__int_string_bool_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ClassTupleDataSourceDrivenTests), new TUnit_TestProject_ClassTupleDataSourceDrivenTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/ConcreteClassTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConcreteClassTests.Test.verified.txt index 12c928eb63e..c7e2e2fb8f4 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConcreteClassTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConcreteClassTests.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_SecondTest = new global::TUnit.Core.TestMetadata { TestName = "SecondTest", TestClassType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), TestMethodName = "SecondTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -44,11 +44,11 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_ Parent = null }) }, - InstanceFactory = TUnit_TestProject_AbstractTests_ConcreteClass2__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SecondTest, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_SecondTest.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_SecondTest }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -65,10 +65,10 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_ HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_SecondTest }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -77,7 +77,7 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_ new global::TUnit.Core.InheritsTestsAttribute() ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AbstractTests.ConcreteClass2 instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_SecondTest(global::TUnit.TestProject.AbstractTests.ConcreteClass2 instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -89,20 +89,49 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_ return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_AbstractTests_ConcreteClass2__ClassHelper -{ + private static global::System.Collections.Generic.IReadOnlyList __Materialize_SecondTest(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "SecondTest", + TestClassType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), + TestMethodName = "SecondTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 11, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2)), + Name = "SecondTest", + 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.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_SecondTest, + }; + metadata.UseRuntimeDataGeneration(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(); @@ -110,7 +139,7 @@ internal static class TUnit_TestProject_AbstractTests_ConcreteClass2__ClassHelpe [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), new TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), new TUnit_TestProject_AbstractTests_ConcreteClass2__TestSource()); } } 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 6ac3112a9b7..e8cb6263039 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 @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_BasicTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_SynchronousTest = new global::TUnit.Core.TestMetadata { TestName = "SynchronousTest", TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -44,11 +44,89 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SynchronousTest, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_SynchronousTest.UseRuntimeDataGeneration(testSessionId); + var metadata_AsynchronousTest = new global::TUnit.Core.TestMetadata + { + TestName = "AsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "AsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 11, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "AsynchronousTest", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsynchronousTest, + }; + metadata_AsynchronousTest.UseRuntimeDataGeneration(testSessionId); + var metadata_ValueTaskAsynchronousTest = new global::TUnit.Core.TestMetadata + { + TestName = "ValueTaskAsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "ValueTaskAsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 17, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "ValueTaskAsynchronousTest", + GenericTypeCount = 0, + ReturnType = typeof(global::System.Threading.Tasks.ValueTask), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.ValueTask)), + Parameters = global::System.Array.Empty(), + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ValueTaskAsynchronousTest, + }; + metadata_ValueTaskAsynchronousTest.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_SynchronousTest, metadata_AsynchronousTest, metadata_ValueTaskAsynchronousTest }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -65,17 +143,47 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_SynchronousTest + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", + ClassName = "BasicTests", + MethodName = "AsynchronousTest", + FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", + FilePath = @"", + LineNumber = 11, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_AsynchronousTest + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + ClassName = "BasicTests", + MethodName = "ValueTaskAsynchronousTest", + FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + FilePath = @"", + LineNumber = 17, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_ValueTaskAsynchronousTest }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ new global::TUnit.Core.TestAttribute() ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_SynchronousTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -87,44 +195,52 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata { - TestName = "AsynchronousTest", + TestName = "SynchronousTest", TestClassType = typeof(global::TUnit.TestProject.BasicTests), - TestMethodName = "AsynchronousTest", + TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 11, + LineNumber = 5, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.BasicTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "AsynchronousTest", + Name = "SynchronousTest", GenericTypeCount = 0, - ReturnType = typeof(global::System.Threading.Tasks.Task), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { @@ -138,63 +254,56 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SynchronousTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsynchronousTest(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", - ClassName = "BasicTests", - MethodName = "AsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", + TestName = "AsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "AsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", LineNumber = 11, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "AsynchronousTest", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsynchronousTest, }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_ValueTaskAsynchronousTest(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -202,7 +311,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "ValueTaskAsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -231,62 +340,12 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ValueTaskAsynchronousTest, }; 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.BasicTests.ValueTaskAsynchronousTest", - ClassName = "BasicTests", - MethodName = "ValueTaskAsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - FilePath = @"", - LineNumber = 17, - 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() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return instance.ValueTaskAsynchronousTest(); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_BasicTests__ClassHelper -{ internal static global::TUnit.TestProject.BasicTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.BasicTests(); @@ -294,8 +353,6 @@ internal static class TUnit_TestProject_BasicTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_AsynchronousTest_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_SynchronousTest_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests__TestSource()); } } 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 6ac3112a9b7..e8cb6263039 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 @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_BasicTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_SynchronousTest = new global::TUnit.Core.TestMetadata { TestName = "SynchronousTest", TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -44,11 +44,89 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SynchronousTest, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_SynchronousTest.UseRuntimeDataGeneration(testSessionId); + var metadata_AsynchronousTest = new global::TUnit.Core.TestMetadata + { + TestName = "AsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "AsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 11, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "AsynchronousTest", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsynchronousTest, + }; + metadata_AsynchronousTest.UseRuntimeDataGeneration(testSessionId); + var metadata_ValueTaskAsynchronousTest = new global::TUnit.Core.TestMetadata + { + TestName = "ValueTaskAsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "ValueTaskAsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 17, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "ValueTaskAsynchronousTest", + GenericTypeCount = 0, + ReturnType = typeof(global::System.Threading.Tasks.ValueTask), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.ValueTask)), + Parameters = global::System.Array.Empty(), + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ValueTaskAsynchronousTest, + }; + metadata_ValueTaskAsynchronousTest.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_SynchronousTest, metadata_AsynchronousTest, metadata_ValueTaskAsynchronousTest }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -65,17 +143,47 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_SynchronousTest + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", + ClassName = "BasicTests", + MethodName = "AsynchronousTest", + FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", + FilePath = @"", + LineNumber = 11, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_AsynchronousTest + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + ClassName = "BasicTests", + MethodName = "ValueTaskAsynchronousTest", + FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + FilePath = @"", + LineNumber = 17, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_ValueTaskAsynchronousTest }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ new global::TUnit.Core.TestAttribute() ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_SynchronousTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -87,44 +195,52 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata { - TestName = "AsynchronousTest", + TestName = "SynchronousTest", TestClassType = typeof(global::TUnit.TestProject.BasicTests), - TestMethodName = "AsynchronousTest", + TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 11, + LineNumber = 5, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.BasicTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "AsynchronousTest", + Name = "SynchronousTest", GenericTypeCount = 0, - ReturnType = typeof(global::System.Threading.Tasks.Task), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { @@ -138,63 +254,56 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SynchronousTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsynchronousTest(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", - ClassName = "BasicTests", - MethodName = "AsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", + TestName = "AsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "AsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", LineNumber = 11, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "AsynchronousTest", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsynchronousTest, }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_ValueTaskAsynchronousTest(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -202,7 +311,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "ValueTaskAsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -231,62 +340,12 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ValueTaskAsynchronousTest, }; 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.BasicTests.ValueTaskAsynchronousTest", - ClassName = "BasicTests", - MethodName = "ValueTaskAsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - FilePath = @"", - LineNumber = 17, - 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() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return instance.ValueTaskAsynchronousTest(); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_BasicTests__ClassHelper -{ internal static global::TUnit.TestProject.BasicTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.BasicTests(); @@ -294,8 +353,6 @@ internal static class TUnit_TestProject_BasicTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_AsynchronousTest_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_SynchronousTest_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests__TestSource()); } } 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 6ac3112a9b7..e8cb6263039 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 @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_BasicTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_SynchronousTest = new global::TUnit.Core.TestMetadata { TestName = "SynchronousTest", TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -44,11 +44,89 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SynchronousTest, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_SynchronousTest.UseRuntimeDataGeneration(testSessionId); + var metadata_AsynchronousTest = new global::TUnit.Core.TestMetadata + { + TestName = "AsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "AsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 11, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "AsynchronousTest", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsynchronousTest, + }; + metadata_AsynchronousTest.UseRuntimeDataGeneration(testSessionId); + var metadata_ValueTaskAsynchronousTest = new global::TUnit.Core.TestMetadata + { + TestName = "ValueTaskAsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "ValueTaskAsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 17, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "ValueTaskAsynchronousTest", + GenericTypeCount = 0, + ReturnType = typeof(global::System.Threading.Tasks.ValueTask), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.ValueTask)), + Parameters = global::System.Array.Empty(), + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ValueTaskAsynchronousTest, + }; + metadata_ValueTaskAsynchronousTest.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_SynchronousTest, metadata_AsynchronousTest, metadata_ValueTaskAsynchronousTest }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -65,17 +143,47 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_SynchronousTest + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", + ClassName = "BasicTests", + MethodName = "AsynchronousTest", + FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", + FilePath = @"", + LineNumber = 11, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_AsynchronousTest + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + ClassName = "BasicTests", + MethodName = "ValueTaskAsynchronousTest", + FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + FilePath = @"", + LineNumber = 17, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_ValueTaskAsynchronousTest }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ new global::TUnit.Core.TestAttribute() ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_SynchronousTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -87,44 +195,52 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata { - TestName = "AsynchronousTest", + TestName = "SynchronousTest", TestClassType = typeof(global::TUnit.TestProject.BasicTests), - TestMethodName = "AsynchronousTest", + TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 11, + LineNumber = 5, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.BasicTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "AsynchronousTest", + Name = "SynchronousTest", GenericTypeCount = 0, - ReturnType = typeof(global::System.Threading.Tasks.Task), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { @@ -138,63 +254,56 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SynchronousTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsynchronousTest(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", - ClassName = "BasicTests", - MethodName = "AsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", + TestName = "AsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "AsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", LineNumber = 11, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "AsynchronousTest", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsynchronousTest, }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_ValueTaskAsynchronousTest(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -202,7 +311,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "ValueTaskAsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -231,62 +340,12 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ValueTaskAsynchronousTest, }; 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.BasicTests.ValueTaskAsynchronousTest", - ClassName = "BasicTests", - MethodName = "ValueTaskAsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - FilePath = @"", - LineNumber = 17, - 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() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return instance.ValueTaskAsynchronousTest(); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_BasicTests__ClassHelper -{ internal static global::TUnit.TestProject.BasicTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.BasicTests(); @@ -294,8 +353,6 @@ internal static class TUnit_TestProject_BasicTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_AsynchronousTest_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_SynchronousTest_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests__TestSource()); } } 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 abf00eea2c1..f717b59d6f0 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 @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_BasicTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_SynchronousTest = new global::TUnit.Core.TestMetadata { TestName = "SynchronousTest", TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -44,11 +44,89 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SynchronousTest, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_SynchronousTest.UseRuntimeDataGeneration(testSessionId); + var metadata_AsynchronousTest = new global::TUnit.Core.TestMetadata + { + TestName = "AsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "AsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 11, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "AsynchronousTest", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsynchronousTest, + }; + metadata_AsynchronousTest.UseRuntimeDataGeneration(testSessionId); + var metadata_ValueTaskAsynchronousTest = new global::TUnit.Core.TestMetadata + { + TestName = "ValueTaskAsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "ValueTaskAsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 17, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "ValueTaskAsynchronousTest", + GenericTypeCount = 0, + ReturnType = typeof(global::System.Threading.Tasks.ValueTask), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.ValueTask)), + Parameters = global::System.Array.Empty(), + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ValueTaskAsynchronousTest, + }; + metadata_ValueTaskAsynchronousTest.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_SynchronousTest, metadata_AsynchronousTest, metadata_ValueTaskAsynchronousTest }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -65,17 +143,47 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_SynchronousTest + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", + ClassName = "BasicTests", + MethodName = "AsynchronousTest", + FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", + FilePath = @"", + LineNumber = 11, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_AsynchronousTest + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + ClassName = "BasicTests", + MethodName = "ValueTaskAsynchronousTest", + FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + FilePath = @"", + LineNumber = 17, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_ValueTaskAsynchronousTest }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ new global::TUnit.Core.TestAttribute() ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_SynchronousTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -87,44 +195,52 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata { - TestName = "AsynchronousTest", + TestName = "SynchronousTest", TestClassType = typeof(global::TUnit.TestProject.BasicTests), - TestMethodName = "AsynchronousTest", + TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 11, + LineNumber = 5, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.BasicTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "AsynchronousTest", + Name = "SynchronousTest", GenericTypeCount = 0, - ReturnType = typeof(global::System.Threading.Tasks.Task), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { @@ -138,63 +254,56 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SynchronousTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsynchronousTest(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", - ClassName = "BasicTests", - MethodName = "AsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", + TestName = "AsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "AsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", LineNumber = 11, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "AsynchronousTest", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsynchronousTest, }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_ValueTaskAsynchronousTest(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -202,7 +311,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "ValueTaskAsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -231,62 +340,12 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ValueTaskAsynchronousTest, }; 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.BasicTests.ValueTaskAsynchronousTest", - ClassName = "BasicTests", - MethodName = "ValueTaskAsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - FilePath = @"", - LineNumber = 17, - 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() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return instance.ValueTaskAsynchronousTest(); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_BasicTests__ClassHelper -{ internal static global::TUnit.TestProject.BasicTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.BasicTests(); @@ -294,8 +353,6 @@ internal static class TUnit_TestProject_BasicTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_AsynchronousTest_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_SynchronousTest_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests__TestSource()); } } 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 fefe151725c..ac8f1bfafa2 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 @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_DataDrivenTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_DataSource_Method__int = new global::TUnit.Core.TestMetadata { TestName = "DataSource_Method", TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "DataSource_Method", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1), @@ -58,81 +58,17 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_T Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.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.DataDrivenTests.DataSource_Method", - ClassName = "DataDrivenTests", - MethodName = "DataSource_Method", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method", - FilePath = @"", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method__int, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_string_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_Method__int.UseRuntimeDataGeneration(testSessionId); + var metadata_DataSource_Method__int_string = new global::TUnit.Core.TestMetadata { TestName = "DataSource_Method", TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "DataSource_Method", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1, "String"), @@ -182,81 +118,17 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_s Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.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.DataDrivenTests.DataSource_Method", - ClassName = "DataDrivenTests", - MethodName = "DataSource_Method", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method", - FilePath = @"", - LineNumber = 17, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method__int_string, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 2: - { - instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_Method__int_string.UseRuntimeDataGeneration(testSessionId); + var metadata_EnumValue__TestEnum = new global::TUnit.Core.TestMetadata { TestName = "EnumValue", TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "EnumValue", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.One), @@ -299,81 +171,17 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_Test Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.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.DataDrivenTests.EnumValue", - ClassName = "DataDrivenTests", - MethodName = "EnumValue", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EnumValue", - FilePath = @"", - LineNumber = 26, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_EnumValue__TestEnum, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.EnumValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_NullValue__string__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_EnumValue__TestEnum.UseRuntimeDataGeneration(testSessionId); + var metadata_NullValue__string_ = new global::TUnit.Core.TestMetadata { TestName = "NullValue", TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "NullValue", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(null), @@ -414,81 +222,17 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NullValue__string__TestS Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.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.DataDrivenTests.NullValue", - ClassName = "DataDrivenTests", - MethodName = "NullValue", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NullValue", - FilePath = @"", - LineNumber = 35, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_NullValue__string_, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.NullValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_EmptyString__string__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_NullValue__string_.UseRuntimeDataGeneration(testSessionId); + var metadata_EmptyString__string_ = new global::TUnit.Core.TestMetadata { TestName = "EmptyString", TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "EmptyString", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(""), @@ -529,96 +273,832 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EmptyString__string__Tes Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_EmptyString__string_, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor + metadata_EmptyString__string_.UseRuntimeDataGeneration(testSessionId); + var metadata_NonEmptyString__string_ = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.DataDrivenTests.EmptyString", - ClassName = "DataDrivenTests", - MethodName = "EmptyString", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EmptyString", - FilePath = @"", + TestName = "NonEmptyString", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "NonEmptyString", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute("Foo bar!"), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 49, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "NonEmptyString", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("NonEmptyString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_NonEmptyString__string_, + }; + metadata_NonEmptyString__string_.UseRuntimeDataGeneration(testSessionId); + var metadata_BooleanString__bool_ = new global::TUnit.Core.TestMetadata + { + TestName = "BooleanString", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "BooleanString", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 56, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "BooleanString", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(bool?)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool?)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("BooleanString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool?) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_BooleanString__bool_, + }; + metadata_BooleanString__bool_.UseRuntimeDataGeneration(testSessionId); + var metadata_Type__Type = new global::TUnit.Core.TestMetadata + { + TestName = "Type", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "Type", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(typeof(object)), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 65, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "Type", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::System.Type)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Type)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("Type", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Type) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Type__Type, + }; + metadata_Type__Type.UseRuntimeDataGeneration(testSessionId); + var metadata_IntegerArray__int__ = new global::TUnit.Core.TestMetadata + { + TestName = "IntegerArray", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "IntegerArray", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(new[] { 1, 2, 3 }), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 72, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "IntegerArray", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int[])) + { + Name = "values", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int[])), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("IntegerArray", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int[]) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_IntegerArray__int__, + }; + metadata_IntegerArray__int__.UseRuntimeDataGeneration(testSessionId); + var metadata_IntMaxValue__int = new global::TUnit.Core.TestMetadata + { + TestName = "IntMaxValue", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "IntMaxValue", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(2147483647), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 79, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "IntMaxValue", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("IntMaxValue", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_IntMaxValue__int, + }; + metadata_IntMaxValue__int.UseRuntimeDataGeneration(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 }; + } + public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + { + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.DataSource_Method", + ClassName = "DataDrivenTests", + MethodName = "DataSource_Method", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method", + FilePath = @"", + LineNumber = 8, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_DataSource_Method__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.DataSource_Method", + ClassName = "DataDrivenTests", + MethodName = "DataSource_Method", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method", + FilePath = @"", + LineNumber = 17, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_DataSource_Method__int_string + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.EnumValue", + ClassName = "DataDrivenTests", + MethodName = "EnumValue", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EnumValue", + FilePath = @"", + LineNumber = 26, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_EnumValue__TestEnum + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.NullValue", + ClassName = "DataDrivenTests", + MethodName = "NullValue", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NullValue", + FilePath = @"", + LineNumber = 35, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_NullValue__string_ + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.EmptyString", + ClassName = "DataDrivenTests", + MethodName = "EmptyString", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EmptyString", + FilePath = @"", LineNumber = 42, Categories = global::System.Array.Empty(), Properties = global::System.Array.Empty(), HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_EmptyString__string_ + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.NonEmptyString", + ClassName = "DataDrivenTests", + MethodName = "NonEmptyString", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NonEmptyString", + FilePath = @"", + LineNumber = 49, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_NonEmptyString__string_ + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.BooleanString", + ClassName = "DataDrivenTests", + MethodName = "BooleanString", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.BooleanString", + FilePath = @"", + LineNumber = 56, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_BooleanString__bool_ + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.Type", + ClassName = "DataDrivenTests", + MethodName = "Type", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.Type", + FilePath = @"", + LineNumber = 65, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Type__Type + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.IntegerArray", + ClassName = "DataDrivenTests", + MethodName = "IntegerArray", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntegerArray", + FilePath = @"", + LineNumber = 72, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_IntegerArray__int__ + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.IntMaxValue", + ClassName = "DataDrivenTests", + MethodName = "IntMaxValue", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntMaxValue", + FilePath = @"", + LineNumber = 79, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + 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 metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_Method", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "DataSource_Method", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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), + }, + 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 + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataSource_Method", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method__int, }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method__int_string(string testSessionId) { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_Method", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "DataSource_Method", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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"), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 17, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataSource_Method", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.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] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "value2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method__int_string, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_EnumValue__TestEnum(string testSessionId) { - try + var metadata = new global::TUnit.Core.TestMetadata { - switch (args.Length) + TestName = "EnumValue", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "EnumValue", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] { - case 1: + 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), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 26, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "EnumValue", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.TestEnum)) { - instance.EmptyString(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); + Name = "testEnum", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TestEnum)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("EnumValue", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.TestEnum) }, null)!.GetParameters()[0] } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } + }, + Class = 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_EnumValue__TestEnum, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_NullValue__string_(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { - TestName = "NonEmptyString", + TestName = "NullValue", TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), - TestMethodName = "NonEmptyString", + TestMethodName = "NullValue", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { - new global::TUnit.Core.ArgumentsAttribute("Foo bar!"), + new global::TUnit.Core.ArgumentsAttribute(null), }, ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 49, + LineNumber = 35, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.DataDrivenTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "NonEmptyString", + Name = "NullValue", GenericTypeCount = 0, ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), @@ -629,7 +1109,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ Name = "value", TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), IsNullable = true, - ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("NonEmptyString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("NullValue", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata @@ -644,73 +1124,123 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_NullValue__string_, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_EmptyString__string_(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.DataDrivenTests.NonEmptyString", - ClassName = "DataDrivenTests", - MethodName = "NonEmptyString", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NonEmptyString", + TestName = "EmptyString", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "EmptyString", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(""), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", - LineNumber = 49, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + LineNumber = 42, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "EmptyString", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("EmptyString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_EmptyString__string_, }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_NonEmptyString__string_(string testSessionId) { - try + var metadata = new global::TUnit.Core.TestMetadata { - switch (args.Length) + TestName = "NonEmptyString", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "NonEmptyString", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] { - case 1: + new global::TUnit.Core.ArgumentsAttribute("Foo bar!"), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 49, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "NonEmptyString", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) { - 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)); - } + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("NonEmptyString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_NonEmptyString__string_, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_BooleanString__bool_(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -718,7 +1248,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__Tes TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "BooleanString", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(null), @@ -761,73 +1291,13 @@ internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__Tes Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_BooleanString__bool_, }; 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.DataDrivenTests.BooleanString", - ClassName = "DataDrivenTests", - MethodName = "BooleanString", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.BooleanString", - FilePath = @"", - LineNumber = 56, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.BooleanString(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Type__Type(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -835,7 +1305,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "Type", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(typeof(object)), @@ -876,73 +1346,13 @@ internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Type__Type, }; 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.DataDrivenTests.Type", - ClassName = "DataDrivenTests", - MethodName = "Type", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.Type", - FilePath = @"", - LineNumber = 65, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.Type(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_IntegerArray__int__(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -950,7 +1360,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___Test TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "IntegerArray", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(new[] { 1, 2, 3 }), @@ -991,73 +1401,13 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___Test Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_IntegerArray__int__, }; 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.DataDrivenTests.IntegerArray", - ClassName = "DataDrivenTests", - MethodName = "IntegerArray", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntegerArray", - FilePath = @"", - LineNumber = 72, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.IntegerArray(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_IntMaxValue__int(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -1065,7 +1415,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSou TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "IntMaxValue", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(2147483647), @@ -1106,72 +1456,12 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSou Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_IntMaxValue__int, }; 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.DataDrivenTests.IntMaxValue", - ClassName = "DataDrivenTests", - MethodName = "IntMaxValue", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntMaxValue", - FilePath = @"", - LineNumber = 79, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.IntMaxValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_DataDrivenTests__ClassHelper -{ internal static global::TUnit.TestProject.DataDrivenTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.DataDrivenTests(); @@ -1179,15 +1469,6 @@ internal static class TUnit_TestProject_DataDrivenTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_BooleanString__bool__TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_DataSource_Method__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_DataSource_Method__int_string_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_EmptyString__string__TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_IntegerArray__int___TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_NonEmptyString__string__TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_NullValue__string__TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_Type__Type_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests__TestSource()); } } 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 fefe151725c..ac8f1bfafa2 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 @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_DataDrivenTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_DataSource_Method__int = new global::TUnit.Core.TestMetadata { TestName = "DataSource_Method", TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "DataSource_Method", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1), @@ -58,81 +58,17 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_T Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.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.DataDrivenTests.DataSource_Method", - ClassName = "DataDrivenTests", - MethodName = "DataSource_Method", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method", - FilePath = @"", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method__int, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_string_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_Method__int.UseRuntimeDataGeneration(testSessionId); + var metadata_DataSource_Method__int_string = new global::TUnit.Core.TestMetadata { TestName = "DataSource_Method", TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "DataSource_Method", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1, "String"), @@ -182,81 +118,17 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_s Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.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.DataDrivenTests.DataSource_Method", - ClassName = "DataDrivenTests", - MethodName = "DataSource_Method", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method", - FilePath = @"", - LineNumber = 17, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method__int_string, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 2: - { - instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_Method__int_string.UseRuntimeDataGeneration(testSessionId); + var metadata_EnumValue__TestEnum = new global::TUnit.Core.TestMetadata { TestName = "EnumValue", TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "EnumValue", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.One), @@ -299,81 +171,17 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_Test Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.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.DataDrivenTests.EnumValue", - ClassName = "DataDrivenTests", - MethodName = "EnumValue", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EnumValue", - FilePath = @"", - LineNumber = 26, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_EnumValue__TestEnum, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.EnumValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_NullValue__string__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_EnumValue__TestEnum.UseRuntimeDataGeneration(testSessionId); + var metadata_NullValue__string_ = new global::TUnit.Core.TestMetadata { TestName = "NullValue", TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "NullValue", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(null), @@ -414,81 +222,17 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NullValue__string__TestS Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.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.DataDrivenTests.NullValue", - ClassName = "DataDrivenTests", - MethodName = "NullValue", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NullValue", - FilePath = @"", - LineNumber = 35, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_NullValue__string_, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.NullValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_EmptyString__string__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_NullValue__string_.UseRuntimeDataGeneration(testSessionId); + var metadata_EmptyString__string_ = new global::TUnit.Core.TestMetadata { TestName = "EmptyString", TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "EmptyString", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(""), @@ -529,96 +273,832 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EmptyString__string__Tes Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_EmptyString__string_, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor + metadata_EmptyString__string_.UseRuntimeDataGeneration(testSessionId); + var metadata_NonEmptyString__string_ = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.DataDrivenTests.EmptyString", - ClassName = "DataDrivenTests", - MethodName = "EmptyString", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EmptyString", - FilePath = @"", + TestName = "NonEmptyString", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "NonEmptyString", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute("Foo bar!"), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 49, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "NonEmptyString", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("NonEmptyString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_NonEmptyString__string_, + }; + metadata_NonEmptyString__string_.UseRuntimeDataGeneration(testSessionId); + var metadata_BooleanString__bool_ = new global::TUnit.Core.TestMetadata + { + TestName = "BooleanString", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "BooleanString", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 56, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "BooleanString", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(bool?)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool?)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("BooleanString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool?) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_BooleanString__bool_, + }; + metadata_BooleanString__bool_.UseRuntimeDataGeneration(testSessionId); + var metadata_Type__Type = new global::TUnit.Core.TestMetadata + { + TestName = "Type", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "Type", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(typeof(object)), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 65, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "Type", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::System.Type)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Type)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("Type", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Type) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Type__Type, + }; + metadata_Type__Type.UseRuntimeDataGeneration(testSessionId); + var metadata_IntegerArray__int__ = new global::TUnit.Core.TestMetadata + { + TestName = "IntegerArray", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "IntegerArray", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(new[] { 1, 2, 3 }), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 72, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "IntegerArray", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int[])) + { + Name = "values", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int[])), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("IntegerArray", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int[]) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_IntegerArray__int__, + }; + metadata_IntegerArray__int__.UseRuntimeDataGeneration(testSessionId); + var metadata_IntMaxValue__int = new global::TUnit.Core.TestMetadata + { + TestName = "IntMaxValue", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "IntMaxValue", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(2147483647), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 79, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "IntMaxValue", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("IntMaxValue", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_IntMaxValue__int, + }; + metadata_IntMaxValue__int.UseRuntimeDataGeneration(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 }; + } + public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + { + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.DataSource_Method", + ClassName = "DataDrivenTests", + MethodName = "DataSource_Method", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method", + FilePath = @"", + LineNumber = 8, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_DataSource_Method__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.DataSource_Method", + ClassName = "DataDrivenTests", + MethodName = "DataSource_Method", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method", + FilePath = @"", + LineNumber = 17, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_DataSource_Method__int_string + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.EnumValue", + ClassName = "DataDrivenTests", + MethodName = "EnumValue", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EnumValue", + FilePath = @"", + LineNumber = 26, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_EnumValue__TestEnum + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.NullValue", + ClassName = "DataDrivenTests", + MethodName = "NullValue", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NullValue", + FilePath = @"", + LineNumber = 35, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_NullValue__string_ + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.EmptyString", + ClassName = "DataDrivenTests", + MethodName = "EmptyString", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EmptyString", + FilePath = @"", LineNumber = 42, Categories = global::System.Array.Empty(), Properties = global::System.Array.Empty(), HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_EmptyString__string_ + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.NonEmptyString", + ClassName = "DataDrivenTests", + MethodName = "NonEmptyString", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NonEmptyString", + FilePath = @"", + LineNumber = 49, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_NonEmptyString__string_ + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.BooleanString", + ClassName = "DataDrivenTests", + MethodName = "BooleanString", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.BooleanString", + FilePath = @"", + LineNumber = 56, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_BooleanString__bool_ + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.Type", + ClassName = "DataDrivenTests", + MethodName = "Type", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.Type", + FilePath = @"", + LineNumber = 65, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Type__Type + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.IntegerArray", + ClassName = "DataDrivenTests", + MethodName = "IntegerArray", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntegerArray", + FilePath = @"", + LineNumber = 72, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_IntegerArray__int__ + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.IntMaxValue", + ClassName = "DataDrivenTests", + MethodName = "IntMaxValue", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntMaxValue", + FilePath = @"", + LineNumber = 79, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + 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 metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_Method", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "DataSource_Method", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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), + }, + 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 + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataSource_Method", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method__int, }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method__int_string(string testSessionId) { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_Method", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "DataSource_Method", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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"), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 17, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataSource_Method", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.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] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "value2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method__int_string, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_EnumValue__TestEnum(string testSessionId) { - try + var metadata = new global::TUnit.Core.TestMetadata { - switch (args.Length) + TestName = "EnumValue", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "EnumValue", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] { - case 1: + 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), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 26, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "EnumValue", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.TestEnum)) { - instance.EmptyString(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); + Name = "testEnum", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TestEnum)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("EnumValue", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.TestEnum) }, null)!.GetParameters()[0] } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } + }, + Class = 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_EnumValue__TestEnum, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_NullValue__string_(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { - TestName = "NonEmptyString", + TestName = "NullValue", TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), - TestMethodName = "NonEmptyString", + TestMethodName = "NullValue", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { - new global::TUnit.Core.ArgumentsAttribute("Foo bar!"), + new global::TUnit.Core.ArgumentsAttribute(null), }, ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 49, + LineNumber = 35, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.DataDrivenTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "NonEmptyString", + Name = "NullValue", GenericTypeCount = 0, ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), @@ -629,7 +1109,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ Name = "value", TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), IsNullable = true, - ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("NonEmptyString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("NullValue", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata @@ -644,73 +1124,123 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_NullValue__string_, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_EmptyString__string_(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.DataDrivenTests.NonEmptyString", - ClassName = "DataDrivenTests", - MethodName = "NonEmptyString", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NonEmptyString", + TestName = "EmptyString", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "EmptyString", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(""), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", - LineNumber = 49, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + LineNumber = 42, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "EmptyString", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("EmptyString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_EmptyString__string_, }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_NonEmptyString__string_(string testSessionId) { - try + var metadata = new global::TUnit.Core.TestMetadata { - switch (args.Length) + TestName = "NonEmptyString", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "NonEmptyString", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] { - case 1: + new global::TUnit.Core.ArgumentsAttribute("Foo bar!"), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 49, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "NonEmptyString", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) { - 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)); - } + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("NonEmptyString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_NonEmptyString__string_, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_BooleanString__bool_(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -718,7 +1248,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__Tes TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "BooleanString", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(null), @@ -761,73 +1291,13 @@ internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__Tes Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_BooleanString__bool_, }; 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.DataDrivenTests.BooleanString", - ClassName = "DataDrivenTests", - MethodName = "BooleanString", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.BooleanString", - FilePath = @"", - LineNumber = 56, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.BooleanString(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Type__Type(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -835,7 +1305,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "Type", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(typeof(object)), @@ -876,73 +1346,13 @@ internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Type__Type, }; 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.DataDrivenTests.Type", - ClassName = "DataDrivenTests", - MethodName = "Type", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.Type", - FilePath = @"", - LineNumber = 65, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.Type(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_IntegerArray__int__(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -950,7 +1360,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___Test TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "IntegerArray", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(new[] { 1, 2, 3 }), @@ -991,73 +1401,13 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___Test Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_IntegerArray__int__, }; 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.DataDrivenTests.IntegerArray", - ClassName = "DataDrivenTests", - MethodName = "IntegerArray", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntegerArray", - FilePath = @"", - LineNumber = 72, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.IntegerArray(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_IntMaxValue__int(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -1065,7 +1415,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSou TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "IntMaxValue", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(2147483647), @@ -1106,72 +1456,12 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSou Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_IntMaxValue__int, }; 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.DataDrivenTests.IntMaxValue", - ClassName = "DataDrivenTests", - MethodName = "IntMaxValue", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntMaxValue", - FilePath = @"", - LineNumber = 79, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.IntMaxValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_DataDrivenTests__ClassHelper -{ internal static global::TUnit.TestProject.DataDrivenTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.DataDrivenTests(); @@ -1179,15 +1469,6 @@ internal static class TUnit_TestProject_DataDrivenTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_BooleanString__bool__TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_DataSource_Method__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_DataSource_Method__int_string_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_EmptyString__string__TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_IntegerArray__int___TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_NonEmptyString__string__TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_NullValue__string__TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_Type__Type_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests__TestSource()); } } 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 fefe151725c..ac8f1bfafa2 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 @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_DataDrivenTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_DataSource_Method__int = new global::TUnit.Core.TestMetadata { TestName = "DataSource_Method", TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "DataSource_Method", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1), @@ -58,81 +58,17 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_T Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.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.DataDrivenTests.DataSource_Method", - ClassName = "DataDrivenTests", - MethodName = "DataSource_Method", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method", - FilePath = @"", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method__int, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_string_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_Method__int.UseRuntimeDataGeneration(testSessionId); + var metadata_DataSource_Method__int_string = new global::TUnit.Core.TestMetadata { TestName = "DataSource_Method", TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "DataSource_Method", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1, "String"), @@ -182,81 +118,17 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_s Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.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.DataDrivenTests.DataSource_Method", - ClassName = "DataDrivenTests", - MethodName = "DataSource_Method", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method", - FilePath = @"", - LineNumber = 17, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method__int_string, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 2: - { - instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_Method__int_string.UseRuntimeDataGeneration(testSessionId); + var metadata_EnumValue__TestEnum = new global::TUnit.Core.TestMetadata { TestName = "EnumValue", TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "EnumValue", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.One), @@ -299,81 +171,17 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_Test Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.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.DataDrivenTests.EnumValue", - ClassName = "DataDrivenTests", - MethodName = "EnumValue", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EnumValue", - FilePath = @"", - LineNumber = 26, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_EnumValue__TestEnum, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.EnumValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_NullValue__string__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_EnumValue__TestEnum.UseRuntimeDataGeneration(testSessionId); + var metadata_NullValue__string_ = new global::TUnit.Core.TestMetadata { TestName = "NullValue", TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "NullValue", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(null), @@ -414,81 +222,17 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NullValue__string__TestS Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.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.DataDrivenTests.NullValue", - ClassName = "DataDrivenTests", - MethodName = "NullValue", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NullValue", - FilePath = @"", - LineNumber = 35, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_NullValue__string_, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.NullValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_EmptyString__string__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_NullValue__string_.UseRuntimeDataGeneration(testSessionId); + var metadata_EmptyString__string_ = new global::TUnit.Core.TestMetadata { TestName = "EmptyString", TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "EmptyString", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(""), @@ -529,96 +273,832 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EmptyString__string__Tes Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_EmptyString__string_, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor + metadata_EmptyString__string_.UseRuntimeDataGeneration(testSessionId); + var metadata_NonEmptyString__string_ = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.DataDrivenTests.EmptyString", - ClassName = "DataDrivenTests", - MethodName = "EmptyString", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EmptyString", - FilePath = @"", + TestName = "NonEmptyString", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "NonEmptyString", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute("Foo bar!"), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 49, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "NonEmptyString", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("NonEmptyString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_NonEmptyString__string_, + }; + metadata_NonEmptyString__string_.UseRuntimeDataGeneration(testSessionId); + var metadata_BooleanString__bool_ = new global::TUnit.Core.TestMetadata + { + TestName = "BooleanString", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "BooleanString", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 56, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "BooleanString", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(bool?)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool?)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("BooleanString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool?) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_BooleanString__bool_, + }; + metadata_BooleanString__bool_.UseRuntimeDataGeneration(testSessionId); + var metadata_Type__Type = new global::TUnit.Core.TestMetadata + { + TestName = "Type", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "Type", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(typeof(object)), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 65, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "Type", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::System.Type)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Type)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("Type", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Type) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Type__Type, + }; + metadata_Type__Type.UseRuntimeDataGeneration(testSessionId); + var metadata_IntegerArray__int__ = new global::TUnit.Core.TestMetadata + { + TestName = "IntegerArray", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "IntegerArray", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(new[] { 1, 2, 3 }), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 72, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "IntegerArray", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int[])) + { + Name = "values", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int[])), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("IntegerArray", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int[]) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_IntegerArray__int__, + }; + metadata_IntegerArray__int__.UseRuntimeDataGeneration(testSessionId); + var metadata_IntMaxValue__int = new global::TUnit.Core.TestMetadata + { + TestName = "IntMaxValue", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "IntMaxValue", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(2147483647), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 79, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "IntMaxValue", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("IntMaxValue", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_IntMaxValue__int, + }; + metadata_IntMaxValue__int.UseRuntimeDataGeneration(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 }; + } + public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + { + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.DataSource_Method", + ClassName = "DataDrivenTests", + MethodName = "DataSource_Method", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method", + FilePath = @"", + LineNumber = 8, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_DataSource_Method__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.DataSource_Method", + ClassName = "DataDrivenTests", + MethodName = "DataSource_Method", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method", + FilePath = @"", + LineNumber = 17, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_DataSource_Method__int_string + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.EnumValue", + ClassName = "DataDrivenTests", + MethodName = "EnumValue", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EnumValue", + FilePath = @"", + LineNumber = 26, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_EnumValue__TestEnum + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.NullValue", + ClassName = "DataDrivenTests", + MethodName = "NullValue", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NullValue", + FilePath = @"", + LineNumber = 35, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_NullValue__string_ + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.EmptyString", + ClassName = "DataDrivenTests", + MethodName = "EmptyString", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EmptyString", + FilePath = @"", LineNumber = 42, Categories = global::System.Array.Empty(), Properties = global::System.Array.Empty(), HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_EmptyString__string_ + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.NonEmptyString", + ClassName = "DataDrivenTests", + MethodName = "NonEmptyString", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NonEmptyString", + FilePath = @"", + LineNumber = 49, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_NonEmptyString__string_ + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.BooleanString", + ClassName = "DataDrivenTests", + MethodName = "BooleanString", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.BooleanString", + FilePath = @"", + LineNumber = 56, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_BooleanString__bool_ + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.Type", + ClassName = "DataDrivenTests", + MethodName = "Type", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.Type", + FilePath = @"", + LineNumber = 65, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Type__Type + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.IntegerArray", + ClassName = "DataDrivenTests", + MethodName = "IntegerArray", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntegerArray", + FilePath = @"", + LineNumber = 72, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_IntegerArray__int__ + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.IntMaxValue", + ClassName = "DataDrivenTests", + MethodName = "IntMaxValue", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntMaxValue", + FilePath = @"", + LineNumber = 79, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + 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 metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_Method", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "DataSource_Method", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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), + }, + 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 + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataSource_Method", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method__int, }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method__int_string(string testSessionId) { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_Method", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "DataSource_Method", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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"), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 17, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataSource_Method", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.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] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "value2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method__int_string, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_EnumValue__TestEnum(string testSessionId) { - try + var metadata = new global::TUnit.Core.TestMetadata { - switch (args.Length) + TestName = "EnumValue", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "EnumValue", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] { - case 1: + 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), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 26, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "EnumValue", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.TestEnum)) { - instance.EmptyString(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); + Name = "testEnum", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TestEnum)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("EnumValue", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.TestEnum) }, null)!.GetParameters()[0] } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } + }, + Class = 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_EnumValue__TestEnum, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_NullValue__string_(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { - TestName = "NonEmptyString", + TestName = "NullValue", TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), - TestMethodName = "NonEmptyString", + TestMethodName = "NullValue", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { - new global::TUnit.Core.ArgumentsAttribute("Foo bar!"), + new global::TUnit.Core.ArgumentsAttribute(null), }, ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 49, + LineNumber = 35, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.DataDrivenTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "NonEmptyString", + Name = "NullValue", GenericTypeCount = 0, ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), @@ -629,7 +1109,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ Name = "value", TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), IsNullable = true, - ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("NonEmptyString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("NullValue", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata @@ -644,73 +1124,123 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_NullValue__string_, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_EmptyString__string_(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.DataDrivenTests.NonEmptyString", - ClassName = "DataDrivenTests", - MethodName = "NonEmptyString", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NonEmptyString", + TestName = "EmptyString", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "EmptyString", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(""), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", - LineNumber = 49, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + LineNumber = 42, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "EmptyString", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("EmptyString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_EmptyString__string_, }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_NonEmptyString__string_(string testSessionId) { - try + var metadata = new global::TUnit.Core.TestMetadata { - switch (args.Length) + TestName = "NonEmptyString", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "NonEmptyString", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] { - case 1: + new global::TUnit.Core.ArgumentsAttribute("Foo bar!"), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 49, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "NonEmptyString", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) { - 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)); - } + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("NonEmptyString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_NonEmptyString__string_, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_BooleanString__bool_(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -718,7 +1248,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__Tes TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "BooleanString", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(null), @@ -761,73 +1291,13 @@ internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__Tes Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_BooleanString__bool_, }; 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.DataDrivenTests.BooleanString", - ClassName = "DataDrivenTests", - MethodName = "BooleanString", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.BooleanString", - FilePath = @"", - LineNumber = 56, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.BooleanString(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Type__Type(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -835,7 +1305,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "Type", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(typeof(object)), @@ -876,73 +1346,13 @@ internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Type__Type, }; 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.DataDrivenTests.Type", - ClassName = "DataDrivenTests", - MethodName = "Type", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.Type", - FilePath = @"", - LineNumber = 65, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.Type(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_IntegerArray__int__(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -950,7 +1360,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___Test TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "IntegerArray", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(new[] { 1, 2, 3 }), @@ -991,73 +1401,13 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___Test Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_IntegerArray__int__, }; 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.DataDrivenTests.IntegerArray", - ClassName = "DataDrivenTests", - MethodName = "IntegerArray", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntegerArray", - FilePath = @"", - LineNumber = 72, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.IntegerArray(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_IntMaxValue__int(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -1065,7 +1415,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSou TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "IntMaxValue", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(2147483647), @@ -1106,72 +1456,12 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSou Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_IntMaxValue__int, }; 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.DataDrivenTests.IntMaxValue", - ClassName = "DataDrivenTests", - MethodName = "IntMaxValue", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntMaxValue", - FilePath = @"", - LineNumber = 79, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.IntMaxValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_DataDrivenTests__ClassHelper -{ internal static global::TUnit.TestProject.DataDrivenTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.DataDrivenTests(); @@ -1179,15 +1469,6 @@ internal static class TUnit_TestProject_DataDrivenTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_BooleanString__bool__TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_DataSource_Method__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_DataSource_Method__int_string_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_EmptyString__string__TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_IntegerArray__int___TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_NonEmptyString__string__TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_NullValue__string__TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_Type__Type_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests__TestSource()); } } 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 902751d49e5..ec883b7d175 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 @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_DataDrivenTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_DataSource_Method__int = new global::TUnit.Core.TestMetadata { TestName = "DataSource_Method", TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "DataSource_Method", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1), @@ -58,81 +58,17 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_T Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.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.DataDrivenTests.DataSource_Method", - ClassName = "DataDrivenTests", - MethodName = "DataSource_Method", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method", - FilePath = @"", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method__int, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_string_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_Method__int.UseRuntimeDataGeneration(testSessionId); + var metadata_DataSource_Method__int_string = new global::TUnit.Core.TestMetadata { TestName = "DataSource_Method", TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "DataSource_Method", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1, "String"), @@ -182,81 +118,17 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_s Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.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.DataDrivenTests.DataSource_Method", - ClassName = "DataDrivenTests", - MethodName = "DataSource_Method", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method", - FilePath = @"", - LineNumber = 17, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method__int_string, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 2: - { - instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_Method__int_string.UseRuntimeDataGeneration(testSessionId); + var metadata_EnumValue__TestEnum = new global::TUnit.Core.TestMetadata { TestName = "EnumValue", TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "EnumValue", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.One), @@ -299,81 +171,17 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_Test Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.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.DataDrivenTests.EnumValue", - ClassName = "DataDrivenTests", - MethodName = "EnumValue", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EnumValue", - FilePath = @"", - LineNumber = 26, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_EnumValue__TestEnum, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.EnumValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_NullValue__string__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_EnumValue__TestEnum.UseRuntimeDataGeneration(testSessionId); + var metadata_NullValue__string_ = new global::TUnit.Core.TestMetadata { TestName = "NullValue", TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "NullValue", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(null), @@ -414,81 +222,17 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NullValue__string__TestS Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.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.DataDrivenTests.NullValue", - ClassName = "DataDrivenTests", - MethodName = "NullValue", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NullValue", - FilePath = @"", - LineNumber = 35, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_NullValue__string_, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.NullValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_EmptyString__string__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_NullValue__string_.UseRuntimeDataGeneration(testSessionId); + var metadata_EmptyString__string_ = new global::TUnit.Core.TestMetadata { TestName = "EmptyString", TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "EmptyString", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(""), @@ -529,96 +273,832 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EmptyString__string__Tes Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_EmptyString__string_, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor + metadata_EmptyString__string_.UseRuntimeDataGeneration(testSessionId); + var metadata_NonEmptyString__string_ = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.DataDrivenTests.EmptyString", - ClassName = "DataDrivenTests", - MethodName = "EmptyString", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EmptyString", - FilePath = @"", - LineNumber = 42, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, + TestName = "NonEmptyString", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "NonEmptyString", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute("Foo bar!"), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 49, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "NonEmptyString", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("NonEmptyString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_NonEmptyString__string_, + }; + metadata_NonEmptyString__string_.UseRuntimeDataGeneration(testSessionId); + var metadata_BooleanString__bool_ = new global::TUnit.Core.TestMetadata + { + TestName = "BooleanString", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "BooleanString", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 56, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "BooleanString", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(bool?)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool?)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("BooleanString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool?) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_BooleanString__bool_, + }; + metadata_BooleanString__bool_.UseRuntimeDataGeneration(testSessionId); + var metadata_Type__Type = new global::TUnit.Core.TestMetadata + { + TestName = "Type", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "Type", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(typeof(object)), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 65, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "Type", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::System.Type)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Type)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("Type", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Type) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Type__Type, + }; + metadata_Type__Type.UseRuntimeDataGeneration(testSessionId); + var metadata_IntegerArray__int__ = new global::TUnit.Core.TestMetadata + { + TestName = "IntegerArray", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "IntegerArray", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(new[] { 1, 2, 3 }), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 72, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "IntegerArray", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int[])) + { + Name = "values", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int[])), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("IntegerArray", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int[]) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_IntegerArray__int__, + }; + metadata_IntegerArray__int__.UseRuntimeDataGeneration(testSessionId); + var metadata_IntMaxValue__int = new global::TUnit.Core.TestMetadata + { + TestName = "IntMaxValue", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "IntMaxValue", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(2147483647), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 79, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "IntMaxValue", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("IntMaxValue", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_IntMaxValue__int, + }; + metadata_IntMaxValue__int.UseRuntimeDataGeneration(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 }; + } + public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + { + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.DataSource_Method", + ClassName = "DataDrivenTests", + MethodName = "DataSource_Method", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method", + FilePath = @"", + LineNumber = 8, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_DataSource_Method__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.DataSource_Method", + ClassName = "DataDrivenTests", + MethodName = "DataSource_Method", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method", + FilePath = @"", + LineNumber = 17, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_DataSource_Method__int_string + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.EnumValue", + ClassName = "DataDrivenTests", + MethodName = "EnumValue", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EnumValue", + FilePath = @"", + LineNumber = 26, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_EnumValue__TestEnum + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.NullValue", + ClassName = "DataDrivenTests", + MethodName = "NullValue", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NullValue", + FilePath = @"", + LineNumber = 35, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_NullValue__string_ + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.EmptyString", + ClassName = "DataDrivenTests", + MethodName = "EmptyString", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EmptyString", + FilePath = @"", + LineNumber = 42, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_EmptyString__string_ + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.NonEmptyString", + ClassName = "DataDrivenTests", + MethodName = "NonEmptyString", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NonEmptyString", + FilePath = @"", + LineNumber = 49, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_NonEmptyString__string_ + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.BooleanString", + ClassName = "DataDrivenTests", + MethodName = "BooleanString", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.BooleanString", + FilePath = @"", + LineNumber = 56, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_BooleanString__bool_ + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.Type", + ClassName = "DataDrivenTests", + MethodName = "Type", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.Type", + FilePath = @"", + LineNumber = 65, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Type__Type + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.IntegerArray", + ClassName = "DataDrivenTests", + MethodName = "IntegerArray", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntegerArray", + FilePath = @"", + LineNumber = 72, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_IntegerArray__int__ + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.IntMaxValue", + ClassName = "DataDrivenTests", + MethodName = "IntMaxValue", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntMaxValue", + FilePath = @"", + LineNumber = 79, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + 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 metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_Method", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "DataSource_Method", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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), + }, + 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 + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataSource_Method", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method__int, }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method__int_string(string testSessionId) { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_Method", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "DataSource_Method", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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"), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 17, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataSource_Method", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.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] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "value2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method__int_string, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_EnumValue__TestEnum(string testSessionId) { - try + var metadata = new global::TUnit.Core.TestMetadata { - switch (args.Length) + TestName = "EnumValue", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "EnumValue", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] { - case 1: + 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), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 26, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "EnumValue", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.TestEnum)) { - instance.EmptyString(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); + Name = "testEnum", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TestEnum)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("EnumValue", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.TestEnum) }, null)!.GetParameters()[0] } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } + }, + Class = 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_EnumValue__TestEnum, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_NullValue__string_(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { - TestName = "NonEmptyString", + TestName = "NullValue", TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), - TestMethodName = "NonEmptyString", + TestMethodName = "NullValue", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { - new global::TUnit.Core.ArgumentsAttribute("Foo bar!"), + new global::TUnit.Core.ArgumentsAttribute(null), }, ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 49, + LineNumber = 35, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.DataDrivenTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "NonEmptyString", + Name = "NullValue", GenericTypeCount = 0, ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), @@ -629,7 +1109,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ Name = "value", TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), IsNullable = true, - ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("NonEmptyString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("NullValue", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata @@ -644,73 +1124,123 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_NullValue__string_, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_EmptyString__string_(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.DataDrivenTests.NonEmptyString", - ClassName = "DataDrivenTests", - MethodName = "NonEmptyString", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NonEmptyString", + TestName = "EmptyString", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "EmptyString", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(""), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", - LineNumber = 49, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + LineNumber = 42, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "EmptyString", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("EmptyString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_EmptyString__string_, }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_NonEmptyString__string_(string testSessionId) { - try + var metadata = new global::TUnit.Core.TestMetadata { - switch (args.Length) + TestName = "NonEmptyString", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "NonEmptyString", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] { - case 1: + new global::TUnit.Core.ArgumentsAttribute("Foo bar!"), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 49, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "NonEmptyString", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) { - instance.NonEmptyString(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("NonEmptyString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } + }, + Class = 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_NonEmptyString__string_, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_BooleanString__bool_(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -718,7 +1248,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__Tes TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "BooleanString", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(null), @@ -761,73 +1291,13 @@ internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__Tes Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_BooleanString__bool_, }; 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.DataDrivenTests.BooleanString", - ClassName = "DataDrivenTests", - MethodName = "BooleanString", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.BooleanString", - FilePath = @"", - LineNumber = 56, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.BooleanString(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Type__Type(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -835,7 +1305,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "Type", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(typeof(object)), @@ -876,73 +1346,13 @@ internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Type__Type, }; 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.DataDrivenTests.Type", - ClassName = "DataDrivenTests", - MethodName = "Type", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.Type", - FilePath = @"", - LineNumber = 65, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.Type(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_IntegerArray__int__(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -950,7 +1360,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___Test TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "IntegerArray", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(new[] { 1, 2, 3 }), @@ -991,73 +1401,13 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___Test Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_IntegerArray__int__, }; 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.DataDrivenTests.IntegerArray", - ClassName = "DataDrivenTests", - MethodName = "IntegerArray", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntegerArray", - FilePath = @"", - LineNumber = 72, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.IntegerArray(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_IntMaxValue__int(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -1065,7 +1415,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSou TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "IntMaxValue", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(2147483647), @@ -1106,72 +1456,12 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSou Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_IntMaxValue__int, }; 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.DataDrivenTests.IntMaxValue", - ClassName = "DataDrivenTests", - MethodName = "IntMaxValue", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntMaxValue", - FilePath = @"", - LineNumber = 79, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.IntMaxValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_DataDrivenTests__ClassHelper -{ internal static global::TUnit.TestProject.DataDrivenTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.DataDrivenTests(); @@ -1179,15 +1469,6 @@ internal static class TUnit_TestProject_DataDrivenTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_BooleanString__bool__TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_DataSource_Method__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_DataSource_Method__int_string_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_EmptyString__string__TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_IntegerArray__int___TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_NonEmptyString__string__TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_NullValue__string__TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_Type__Type_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests__TestSource()); } } 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 8c828247e05..ce06e878d97 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 @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_MatrixTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_MatrixTest_One__string_int_bool = new global::TUnit.Core.TestMetadata { TestName = "MatrixTest_One", TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "MatrixTest_One", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -70,80 +70,17 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_b Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.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.MatrixTests.MatrixTest_One", - ClassName = "MatrixTests", - MethodName = "MatrixTest_One", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_One", - FilePath = @"", - LineNumber = 9, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixTest_One__string_int_bool, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 3: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_One(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_MatrixTest_One__string_int_bool.UseRuntimeDataGeneration(testSessionId); + var metadata_MatrixTest_Two__int_int_int_bool = new global::TUnit.Core.TestMetadata { TestName = "MatrixTest_Two", TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "MatrixTest_Two", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -205,80 +142,17 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_ Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.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.MatrixTests.MatrixTest_Two", - ClassName = "MatrixTests", - MethodName = "MatrixTest_Two", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_Two", - FilePath = @"", - LineNumber = 19, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixTest_Two__int_int_int_bool, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 4: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_Two(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 4 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnum_TestEnum__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_MatrixTest_Two__int_int_int_bool.UseRuntimeDataGeneration(testSessionId); + var metadata_MatrixTest_Enum__int_TestEnum_TestEnum_ = new global::TUnit.Core.TestMetadata { TestName = "MatrixTest_Enum", TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "MatrixTest_Enum", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -333,80 +207,17 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnu Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.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.MatrixTests.MatrixTest_Enum", - ClassName = "MatrixTests", - MethodName = "MatrixTest_Enum", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_Enum", - FilePath = @"", - LineNumber = 30, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixTest_Enum__int_TestEnum_TestEnum_, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 3: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_Enum(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_MatrixTest_Enum__int_TestEnum_TestEnum_.UseRuntimeDataGeneration(testSessionId); + var metadata_AutoGenerateBools__string_bool = new global::TUnit.Core.TestMetadata { TestName = "AutoGenerateBools", TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "AutoGenerateBools", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -454,80 +265,17 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bo Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.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.MatrixTests.AutoGenerateBools", - ClassName = "MatrixTests", - MethodName = "AutoGenerateBools", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.AutoGenerateBools", - FilePath = @"", - LineNumber = 40, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AutoGenerateBools__string_bool, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.AutoGenerateBools(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_bool__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_AutoGenerateBools__string_bool.UseRuntimeDataGeneration(testSessionId); + var metadata_AutoGenerateBools2__string_bool_ = new global::TUnit.Core.TestMetadata { TestName = "AutoGenerateBools2", TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "AutoGenerateBools2", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -575,80 +323,17 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_b Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AutoGenerateBools2__string_bool_, }; - 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.MatrixTests.AutoGenerateBools2", - ClassName = "MatrixTests", - MethodName = "AutoGenerateBools2", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.AutoGenerateBools2", - FilePath = @"", - LineNumber = 49, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.AutoGenerateBools2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_AutoGenerateBools2__string_bool_.UseRuntimeDataGeneration(testSessionId); + var metadata_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool = new global::TUnit.Core.TestMetadata { TestName = "ImplicitConversion", TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "ImplicitConversion", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -696,80 +381,17 @@ internal sealed class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_Te Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.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.MatrixTests.ImplicitConversion", - ClassName = "MatrixTests", - MethodName = "ImplicitConversion", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.ImplicitConversion", - FilePath = @"", - LineNumber = 58, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.ImplicitConversion(global::TUnit.Core.Helpers.CastHelper.Cast>(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool.UseRuntimeDataGeneration(testSessionId); + var metadata_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool = new global::TUnit.Core.TestMetadata { TestName = "ExcludingAutoGeneratedMatrixValues", TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "ExcludingAutoGeneratedMatrixValues", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -817,80 +439,17 @@ internal sealed class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrix Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.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.MatrixTests.ExcludingAutoGeneratedMatrixValues", - ClassName = "MatrixTests", - MethodName = "ExcludingAutoGeneratedMatrixValues", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.ExcludingAutoGeneratedMatrixValues", - FilePath = @"", - LineNumber = 67, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.ExcludingAutoGeneratedMatrixValues(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_Method1__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool.UseRuntimeDataGeneration(testSessionId); + var metadata_Method1__int = new global::TUnit.Core.TestMetadata { TestName = "Method1", TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Method1", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -931,80 +490,17 @@ internal sealed class TUnit_TestProject_MatrixTests_Method1__int_TestSource : gl Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.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.MatrixTests.Method1", - ClassName = "MatrixTests", - MethodName = "Method1", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method1", - FilePath = @"", - LineNumber = 116, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Method1__int, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Method1(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_Method2__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_Method1__int.UseRuntimeDataGeneration(testSessionId); + var metadata_Method2__int = new global::TUnit.Core.TestMetadata { TestName = "Method2", TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Method2", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1045,72 +541,1267 @@ internal sealed class TUnit_TestProject_MatrixTests_Method2__int_TestSource : gl Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Method2__int, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor + metadata_Method2__int.UseRuntimeDataGeneration(testSessionId); + var metadata_Method3__int = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.MatrixTests.Method2", - ClassName = "MatrixTests", - MethodName = "Method2", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method2", + TestName = "Method3", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "Method3", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, FilePath = @"", - LineNumber = 124, - 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() - { + LineNumber = 132, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "Method3", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "item", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method3", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Method3__int, + }; + metadata_Method3__int.UseRuntimeDataGeneration(testSessionId); + var metadata_Method4__int = new global::TUnit.Core.TestMetadata + { + TestName = "Method4", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "Method4", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 140, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "Method4", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "item", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method4", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Method4__int, + }; + metadata_Method4__int.UseRuntimeDataGeneration(testSessionId); + var metadata_Exclusion__int_int = new global::TUnit.Core.TestMetadata + { + TestName = "Exclusion", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "Exclusion", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_1, + 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 = 0, + FilePath = @"", + LineNumber = 148, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "Exclusion", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "item", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Exclusion", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "item2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Exclusion", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Exclusion__int_int, + }; + metadata_Exclusion__int_int.UseRuntimeDataGeneration(testSessionId); + var metadata_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum = new global::TUnit.Core.TestMetadata + { + TestName = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 197, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "flag", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool), typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)) + { + Name = "enum", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool), typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum, + }; + metadata_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum.UseRuntimeDataGeneration(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 }; + } + public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + { + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.MatrixTest_One", + ClassName = "MatrixTests", + MethodName = "MatrixTest_One", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_One", + FilePath = @"", + LineNumber = 9, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_MatrixTest_One__string_int_bool + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.MatrixTest_Two", + ClassName = "MatrixTests", + MethodName = "MatrixTest_Two", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_Two", + FilePath = @"", + LineNumber = 19, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_MatrixTest_Two__int_int_int_bool + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.MatrixTest_Enum", + ClassName = "MatrixTests", + MethodName = "MatrixTest_Enum", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_Enum", + FilePath = @"", + LineNumber = 30, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_MatrixTest_Enum__int_TestEnum_TestEnum_ + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.AutoGenerateBools", + ClassName = "MatrixTests", + MethodName = "AutoGenerateBools", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.AutoGenerateBools", + FilePath = @"", + LineNumber = 40, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_AutoGenerateBools__string_bool + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.AutoGenerateBools2", + ClassName = "MatrixTests", + MethodName = "AutoGenerateBools2", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.AutoGenerateBools2", + FilePath = @"", + LineNumber = 49, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_AutoGenerateBools2__string_bool_ + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.ImplicitConversion", + ClassName = "MatrixTests", + MethodName = "ImplicitConversion", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.ImplicitConversion", + FilePath = @"", + LineNumber = 58, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.ExcludingAutoGeneratedMatrixValues", + ClassName = "MatrixTests", + MethodName = "ExcludingAutoGeneratedMatrixValues", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.ExcludingAutoGeneratedMatrixValues", + FilePath = @"", + LineNumber = 67, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.Method1", + ClassName = "MatrixTests", + MethodName = "Method1", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method1", + FilePath = @"", + LineNumber = 116, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Method1__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.Method2", + ClassName = "MatrixTests", + MethodName = "Method2", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method2", + FilePath = @"", + LineNumber = 124, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Method2__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.Method3", + ClassName = "MatrixTests", + MethodName = "Method3", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method3", + FilePath = @"", + LineNumber = 132, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Method3__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.Method4", + ClassName = "MatrixTests", + MethodName = "Method4", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method4", + FilePath = @"", + LineNumber = 140, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Method4__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.Exclusion", + ClassName = "MatrixTests", + MethodName = "Exclusion", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.Exclusion", + FilePath = @"", + LineNumber = 148, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Exclusion__int_int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", + ClassName = "MatrixTests", + MethodName = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", + FilePath = @"", + LineNumber = 197, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + 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(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + 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 metadata = new global::TUnit.Core.TestMetadata + { + TestName = "MatrixTest_One", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "MatrixTest_One", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 9, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTest_One", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "str", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(int), typeof(bool) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "i", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(int), typeof(bool) }, null)!.GetParameters()[1] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "boolean", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(int), typeof(bool) }, null)!.GetParameters()[2] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixTest_One__string_int_bool, + }; + metadata.UseRuntimeDataGeneration(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 metadata = new global::TUnit.Core.TestMetadata + { + TestName = "MatrixTest_Two", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "MatrixTest_Two", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 19, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTest_Two", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "i", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int), typeof(int), typeof(bool) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "i2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int), typeof(int), typeof(bool) }, null)!.GetParameters()[1] + }, + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "i3", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int), typeof(int), typeof(bool) }, null)!.GetParameters()[2] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "boolean", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int), typeof(int), typeof(bool) }, null)!.GetParameters()[3] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixTest_Two__int_int_int_bool, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_MatrixTest_Enum__int_TestEnum_TestEnum_(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "MatrixTest_Enum", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "MatrixTest_Enum", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 30, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTest_Enum", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "i", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Enum", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(TestEnum), typeof(TestEnum?) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(TestEnum)) + { + Name = "testEnum", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(TestEnum)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Enum", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(TestEnum), typeof(TestEnum?) }, null)!.GetParameters()[1] + }, + new global::TUnit.Core.ParameterMetadata(typeof(TestEnum?)) + { + Name = "testEnum2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(TestEnum?)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Enum", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(TestEnum), typeof(TestEnum?) }, null)!.GetParameters()[2] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixTest_Enum__int_TestEnum_TestEnum_, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_AutoGenerateBools__string_bool(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "AutoGenerateBools", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "AutoGenerateBools", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 40, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "AutoGenerateBools", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "str", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("AutoGenerateBools", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(bool) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "boolean", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("AutoGenerateBools", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(bool) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AutoGenerateBools__string_bool, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_AutoGenerateBools2__string_bool_(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "AutoGenerateBools2", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "AutoGenerateBools2", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 49, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "AutoGenerateBools2", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "str", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("AutoGenerateBools2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(bool?) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool?)) + { + Name = "boolean", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool?)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("AutoGenerateBools2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(bool?) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AutoGenerateBools2__string_bool_, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool(string testSessionId) { - try + var metadata = new global::TUnit.Core.TestMetadata { - switch (args.Length) + TestName = "ImplicitConversion", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "ImplicitConversion", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] { - case 1: + new global::TUnit.Core.MatrixDataSourceAttribute(), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 58, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "ImplicitConversion", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(OneOf)) { - return new global::System.Threading.Tasks.ValueTask(instance.Method2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + Name = "enum", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(OneOf)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("ImplicitConversion", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(OneOf), typeof(bool) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "boolean", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("ImplicitConversion", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(OneOf), typeof(bool) }, null)!.GetParameters()[1] } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) + }, + Class = 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } + TestName = "ExcludingAutoGeneratedMatrixValues", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "ExcludingAutoGeneratedMatrixValues", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 67, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "ExcludingAutoGeneratedMatrixValues", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)) + { + Name = "enum", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("ExcludingAutoGeneratedMatrixValues", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), typeof(bool) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "boolean", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("ExcludingAutoGeneratedMatrixValues", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), typeof(bool) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Method1__int(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "Method1", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "Method1", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 116, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "Method1", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "item", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method1", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Method1__int, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Method2__int(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "Method2", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "Method2", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 124, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "Method2", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "item", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Method2__int, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Method3__int(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -1118,7 +1809,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : gl TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Method3", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1159,72 +1850,13 @@ internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : gl Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Method3__int, }; 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.MatrixTests.Method3", - ClassName = "MatrixTests", - MethodName = "Method3", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method3", - FilePath = @"", - LineNumber = 132, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Method3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Method4__int(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -1232,7 +1864,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : gl TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Method4", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1273,72 +1905,13 @@ internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : gl Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Method4__int, }; 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.MatrixTests.Method4", - ClassName = "MatrixTests", - MethodName = "Method4", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method4", - FilePath = @"", - LineNumber = 140, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Method4(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Exclusion__int_int(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -1346,7 +1919,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSourc TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Exclusion", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_1, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1394,75 +1967,13 @@ internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSourc Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Exclusion__int_int, }; 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.MatrixTests.Exclusion", - ClassName = "MatrixTests", - MethodName = "Exclusion", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Exclusion", - FilePath = @"", - LineNumber = 148, - 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.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(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)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__boo_38BEEE8F_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -1470,7 +1981,7 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParamet TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1518,71 +2029,12 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParamet Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum, }; 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.MatrixTests.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", - ClassName = "MatrixTests", - MethodName = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", - FilePath = @"", - LineNumber = 197, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_MatrixTests__ClassHelper -{ internal static global::TUnit.TestProject.MatrixTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.MatrixTests(); @@ -1590,18 +2042,6 @@ internal static class TUnit_TestProject_MatrixTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_bool__TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bool_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__boo_38BEEE8F_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnum_TestEnum__TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_bool_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_bool_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Method1__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Method2__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Method3__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Method4__int_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests__TestSource()); } } 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 8c828247e05..ce06e878d97 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 @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_MatrixTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_MatrixTest_One__string_int_bool = new global::TUnit.Core.TestMetadata { TestName = "MatrixTest_One", TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "MatrixTest_One", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -70,80 +70,17 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_b Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.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.MatrixTests.MatrixTest_One", - ClassName = "MatrixTests", - MethodName = "MatrixTest_One", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_One", - FilePath = @"", - LineNumber = 9, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixTest_One__string_int_bool, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 3: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_One(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_MatrixTest_One__string_int_bool.UseRuntimeDataGeneration(testSessionId); + var metadata_MatrixTest_Two__int_int_int_bool = new global::TUnit.Core.TestMetadata { TestName = "MatrixTest_Two", TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "MatrixTest_Two", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -205,80 +142,17 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_ Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.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.MatrixTests.MatrixTest_Two", - ClassName = "MatrixTests", - MethodName = "MatrixTest_Two", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_Two", - FilePath = @"", - LineNumber = 19, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixTest_Two__int_int_int_bool, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 4: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_Two(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 4 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnum_TestEnum__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_MatrixTest_Two__int_int_int_bool.UseRuntimeDataGeneration(testSessionId); + var metadata_MatrixTest_Enum__int_TestEnum_TestEnum_ = new global::TUnit.Core.TestMetadata { TestName = "MatrixTest_Enum", TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "MatrixTest_Enum", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -333,80 +207,17 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnu Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.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.MatrixTests.MatrixTest_Enum", - ClassName = "MatrixTests", - MethodName = "MatrixTest_Enum", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_Enum", - FilePath = @"", - LineNumber = 30, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixTest_Enum__int_TestEnum_TestEnum_, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 3: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_Enum(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_MatrixTest_Enum__int_TestEnum_TestEnum_.UseRuntimeDataGeneration(testSessionId); + var metadata_AutoGenerateBools__string_bool = new global::TUnit.Core.TestMetadata { TestName = "AutoGenerateBools", TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "AutoGenerateBools", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -454,80 +265,17 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bo Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.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.MatrixTests.AutoGenerateBools", - ClassName = "MatrixTests", - MethodName = "AutoGenerateBools", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.AutoGenerateBools", - FilePath = @"", - LineNumber = 40, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AutoGenerateBools__string_bool, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.AutoGenerateBools(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_bool__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_AutoGenerateBools__string_bool.UseRuntimeDataGeneration(testSessionId); + var metadata_AutoGenerateBools2__string_bool_ = new global::TUnit.Core.TestMetadata { TestName = "AutoGenerateBools2", TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "AutoGenerateBools2", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -575,80 +323,17 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_b Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AutoGenerateBools2__string_bool_, }; - 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.MatrixTests.AutoGenerateBools2", - ClassName = "MatrixTests", - MethodName = "AutoGenerateBools2", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.AutoGenerateBools2", - FilePath = @"", - LineNumber = 49, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.AutoGenerateBools2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_AutoGenerateBools2__string_bool_.UseRuntimeDataGeneration(testSessionId); + var metadata_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool = new global::TUnit.Core.TestMetadata { TestName = "ImplicitConversion", TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "ImplicitConversion", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -696,80 +381,17 @@ internal sealed class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_Te Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.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.MatrixTests.ImplicitConversion", - ClassName = "MatrixTests", - MethodName = "ImplicitConversion", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.ImplicitConversion", - FilePath = @"", - LineNumber = 58, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.ImplicitConversion(global::TUnit.Core.Helpers.CastHelper.Cast>(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool.UseRuntimeDataGeneration(testSessionId); + var metadata_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool = new global::TUnit.Core.TestMetadata { TestName = "ExcludingAutoGeneratedMatrixValues", TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "ExcludingAutoGeneratedMatrixValues", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -817,80 +439,17 @@ internal sealed class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrix Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.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.MatrixTests.ExcludingAutoGeneratedMatrixValues", - ClassName = "MatrixTests", - MethodName = "ExcludingAutoGeneratedMatrixValues", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.ExcludingAutoGeneratedMatrixValues", - FilePath = @"", - LineNumber = 67, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.ExcludingAutoGeneratedMatrixValues(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_Method1__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool.UseRuntimeDataGeneration(testSessionId); + var metadata_Method1__int = new global::TUnit.Core.TestMetadata { TestName = "Method1", TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Method1", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -931,80 +490,17 @@ internal sealed class TUnit_TestProject_MatrixTests_Method1__int_TestSource : gl Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.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.MatrixTests.Method1", - ClassName = "MatrixTests", - MethodName = "Method1", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method1", - FilePath = @"", - LineNumber = 116, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Method1__int, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Method1(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_Method2__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_Method1__int.UseRuntimeDataGeneration(testSessionId); + var metadata_Method2__int = new global::TUnit.Core.TestMetadata { TestName = "Method2", TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Method2", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1045,72 +541,1267 @@ internal sealed class TUnit_TestProject_MatrixTests_Method2__int_TestSource : gl Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Method2__int, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor + metadata_Method2__int.UseRuntimeDataGeneration(testSessionId); + var metadata_Method3__int = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.MatrixTests.Method2", - ClassName = "MatrixTests", - MethodName = "Method2", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method2", + TestName = "Method3", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "Method3", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, FilePath = @"", - LineNumber = 124, - 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() - { + LineNumber = 132, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "Method3", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "item", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method3", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Method3__int, + }; + metadata_Method3__int.UseRuntimeDataGeneration(testSessionId); + var metadata_Method4__int = new global::TUnit.Core.TestMetadata + { + TestName = "Method4", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "Method4", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 140, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "Method4", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "item", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method4", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Method4__int, + }; + metadata_Method4__int.UseRuntimeDataGeneration(testSessionId); + var metadata_Exclusion__int_int = new global::TUnit.Core.TestMetadata + { + TestName = "Exclusion", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "Exclusion", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_1, + 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 = 0, + FilePath = @"", + LineNumber = 148, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "Exclusion", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "item", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Exclusion", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "item2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Exclusion", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Exclusion__int_int, + }; + metadata_Exclusion__int_int.UseRuntimeDataGeneration(testSessionId); + var metadata_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum = new global::TUnit.Core.TestMetadata + { + TestName = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 197, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "flag", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool), typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)) + { + Name = "enum", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool), typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum, + }; + metadata_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum.UseRuntimeDataGeneration(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 }; + } + public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + { + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.MatrixTest_One", + ClassName = "MatrixTests", + MethodName = "MatrixTest_One", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_One", + FilePath = @"", + LineNumber = 9, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_MatrixTest_One__string_int_bool + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.MatrixTest_Two", + ClassName = "MatrixTests", + MethodName = "MatrixTest_Two", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_Two", + FilePath = @"", + LineNumber = 19, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_MatrixTest_Two__int_int_int_bool + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.MatrixTest_Enum", + ClassName = "MatrixTests", + MethodName = "MatrixTest_Enum", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_Enum", + FilePath = @"", + LineNumber = 30, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_MatrixTest_Enum__int_TestEnum_TestEnum_ + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.AutoGenerateBools", + ClassName = "MatrixTests", + MethodName = "AutoGenerateBools", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.AutoGenerateBools", + FilePath = @"", + LineNumber = 40, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_AutoGenerateBools__string_bool + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.AutoGenerateBools2", + ClassName = "MatrixTests", + MethodName = "AutoGenerateBools2", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.AutoGenerateBools2", + FilePath = @"", + LineNumber = 49, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_AutoGenerateBools2__string_bool_ + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.ImplicitConversion", + ClassName = "MatrixTests", + MethodName = "ImplicitConversion", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.ImplicitConversion", + FilePath = @"", + LineNumber = 58, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.ExcludingAutoGeneratedMatrixValues", + ClassName = "MatrixTests", + MethodName = "ExcludingAutoGeneratedMatrixValues", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.ExcludingAutoGeneratedMatrixValues", + FilePath = @"", + LineNumber = 67, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.Method1", + ClassName = "MatrixTests", + MethodName = "Method1", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method1", + FilePath = @"", + LineNumber = 116, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Method1__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.Method2", + ClassName = "MatrixTests", + MethodName = "Method2", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method2", + FilePath = @"", + LineNumber = 124, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Method2__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.Method3", + ClassName = "MatrixTests", + MethodName = "Method3", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method3", + FilePath = @"", + LineNumber = 132, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Method3__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.Method4", + ClassName = "MatrixTests", + MethodName = "Method4", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method4", + FilePath = @"", + LineNumber = 140, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Method4__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.Exclusion", + ClassName = "MatrixTests", + MethodName = "Exclusion", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.Exclusion", + FilePath = @"", + LineNumber = 148, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Exclusion__int_int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", + ClassName = "MatrixTests", + MethodName = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", + FilePath = @"", + LineNumber = 197, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + 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(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + 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 metadata = new global::TUnit.Core.TestMetadata + { + TestName = "MatrixTest_One", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "MatrixTest_One", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 9, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTest_One", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "str", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(int), typeof(bool) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "i", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(int), typeof(bool) }, null)!.GetParameters()[1] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "boolean", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(int), typeof(bool) }, null)!.GetParameters()[2] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixTest_One__string_int_bool, + }; + metadata.UseRuntimeDataGeneration(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 metadata = new global::TUnit.Core.TestMetadata + { + TestName = "MatrixTest_Two", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "MatrixTest_Two", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 19, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTest_Two", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "i", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int), typeof(int), typeof(bool) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "i2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int), typeof(int), typeof(bool) }, null)!.GetParameters()[1] + }, + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "i3", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int), typeof(int), typeof(bool) }, null)!.GetParameters()[2] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "boolean", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int), typeof(int), typeof(bool) }, null)!.GetParameters()[3] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixTest_Two__int_int_int_bool, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_MatrixTest_Enum__int_TestEnum_TestEnum_(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "MatrixTest_Enum", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "MatrixTest_Enum", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 30, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTest_Enum", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "i", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Enum", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(TestEnum), typeof(TestEnum?) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(TestEnum)) + { + Name = "testEnum", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(TestEnum)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Enum", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(TestEnum), typeof(TestEnum?) }, null)!.GetParameters()[1] + }, + new global::TUnit.Core.ParameterMetadata(typeof(TestEnum?)) + { + Name = "testEnum2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(TestEnum?)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Enum", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(TestEnum), typeof(TestEnum?) }, null)!.GetParameters()[2] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixTest_Enum__int_TestEnum_TestEnum_, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_AutoGenerateBools__string_bool(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "AutoGenerateBools", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "AutoGenerateBools", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 40, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "AutoGenerateBools", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "str", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("AutoGenerateBools", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(bool) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "boolean", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("AutoGenerateBools", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(bool) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AutoGenerateBools__string_bool, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_AutoGenerateBools2__string_bool_(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "AutoGenerateBools2", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "AutoGenerateBools2", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 49, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "AutoGenerateBools2", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "str", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("AutoGenerateBools2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(bool?) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool?)) + { + Name = "boolean", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool?)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("AutoGenerateBools2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(bool?) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AutoGenerateBools2__string_bool_, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool(string testSessionId) { - try + var metadata = new global::TUnit.Core.TestMetadata { - switch (args.Length) + TestName = "ImplicitConversion", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "ImplicitConversion", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] { - case 1: + new global::TUnit.Core.MatrixDataSourceAttribute(), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 58, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "ImplicitConversion", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(OneOf)) { - return new global::System.Threading.Tasks.ValueTask(instance.Method2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + Name = "enum", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(OneOf)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("ImplicitConversion", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(OneOf), typeof(bool) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "boolean", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("ImplicitConversion", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(OneOf), typeof(bool) }, null)!.GetParameters()[1] } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) + }, + Class = 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } + TestName = "ExcludingAutoGeneratedMatrixValues", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "ExcludingAutoGeneratedMatrixValues", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 67, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "ExcludingAutoGeneratedMatrixValues", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)) + { + Name = "enum", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("ExcludingAutoGeneratedMatrixValues", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), typeof(bool) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "boolean", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("ExcludingAutoGeneratedMatrixValues", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), typeof(bool) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Method1__int(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "Method1", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "Method1", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 116, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "Method1", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "item", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method1", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Method1__int, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Method2__int(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "Method2", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "Method2", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 124, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "Method2", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "item", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Method2__int, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Method3__int(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -1118,7 +1809,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : gl TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Method3", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1159,72 +1850,13 @@ internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : gl Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Method3__int, }; 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.MatrixTests.Method3", - ClassName = "MatrixTests", - MethodName = "Method3", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method3", - FilePath = @"", - LineNumber = 132, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Method3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Method4__int(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -1232,7 +1864,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : gl TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Method4", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1273,72 +1905,13 @@ internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : gl Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Method4__int, }; 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.MatrixTests.Method4", - ClassName = "MatrixTests", - MethodName = "Method4", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method4", - FilePath = @"", - LineNumber = 140, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Method4(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Exclusion__int_int(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -1346,7 +1919,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSourc TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Exclusion", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_1, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1394,75 +1967,13 @@ internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSourc Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Exclusion__int_int, }; 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.MatrixTests.Exclusion", - ClassName = "MatrixTests", - MethodName = "Exclusion", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Exclusion", - FilePath = @"", - LineNumber = 148, - 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.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(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)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__boo_38BEEE8F_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -1470,7 +1981,7 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParamet TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1518,71 +2029,12 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParamet Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum, }; 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.MatrixTests.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", - ClassName = "MatrixTests", - MethodName = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", - FilePath = @"", - LineNumber = 197, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_MatrixTests__ClassHelper -{ internal static global::TUnit.TestProject.MatrixTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.MatrixTests(); @@ -1590,18 +2042,6 @@ internal static class TUnit_TestProject_MatrixTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_bool__TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bool_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__boo_38BEEE8F_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnum_TestEnum__TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_bool_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_bool_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Method1__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Method2__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Method3__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Method4__int_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests__TestSource()); } } 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 8c828247e05..ce06e878d97 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 @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_MatrixTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_MatrixTest_One__string_int_bool = new global::TUnit.Core.TestMetadata { TestName = "MatrixTest_One", TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "MatrixTest_One", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -70,80 +70,17 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_b Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.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.MatrixTests.MatrixTest_One", - ClassName = "MatrixTests", - MethodName = "MatrixTest_One", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_One", - FilePath = @"", - LineNumber = 9, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixTest_One__string_int_bool, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 3: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_One(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_MatrixTest_One__string_int_bool.UseRuntimeDataGeneration(testSessionId); + var metadata_MatrixTest_Two__int_int_int_bool = new global::TUnit.Core.TestMetadata { TestName = "MatrixTest_Two", TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "MatrixTest_Two", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -205,80 +142,17 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_ Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.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.MatrixTests.MatrixTest_Two", - ClassName = "MatrixTests", - MethodName = "MatrixTest_Two", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_Two", - FilePath = @"", - LineNumber = 19, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixTest_Two__int_int_int_bool, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 4: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_Two(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 4 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnum_TestEnum__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_MatrixTest_Two__int_int_int_bool.UseRuntimeDataGeneration(testSessionId); + var metadata_MatrixTest_Enum__int_TestEnum_TestEnum_ = new global::TUnit.Core.TestMetadata { TestName = "MatrixTest_Enum", TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "MatrixTest_Enum", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -333,80 +207,17 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnu Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.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.MatrixTests.MatrixTest_Enum", - ClassName = "MatrixTests", - MethodName = "MatrixTest_Enum", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_Enum", - FilePath = @"", - LineNumber = 30, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixTest_Enum__int_TestEnum_TestEnum_, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 3: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_Enum(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_MatrixTest_Enum__int_TestEnum_TestEnum_.UseRuntimeDataGeneration(testSessionId); + var metadata_AutoGenerateBools__string_bool = new global::TUnit.Core.TestMetadata { TestName = "AutoGenerateBools", TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "AutoGenerateBools", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -454,80 +265,17 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bo Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.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.MatrixTests.AutoGenerateBools", - ClassName = "MatrixTests", - MethodName = "AutoGenerateBools", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.AutoGenerateBools", - FilePath = @"", - LineNumber = 40, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AutoGenerateBools__string_bool, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.AutoGenerateBools(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_bool__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_AutoGenerateBools__string_bool.UseRuntimeDataGeneration(testSessionId); + var metadata_AutoGenerateBools2__string_bool_ = new global::TUnit.Core.TestMetadata { TestName = "AutoGenerateBools2", TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "AutoGenerateBools2", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -575,80 +323,17 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_b Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AutoGenerateBools2__string_bool_, }; - 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.MatrixTests.AutoGenerateBools2", - ClassName = "MatrixTests", - MethodName = "AutoGenerateBools2", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.AutoGenerateBools2", - FilePath = @"", - LineNumber = 49, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.AutoGenerateBools2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_AutoGenerateBools2__string_bool_.UseRuntimeDataGeneration(testSessionId); + var metadata_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool = new global::TUnit.Core.TestMetadata { TestName = "ImplicitConversion", TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "ImplicitConversion", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -696,80 +381,17 @@ internal sealed class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_Te Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.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.MatrixTests.ImplicitConversion", - ClassName = "MatrixTests", - MethodName = "ImplicitConversion", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.ImplicitConversion", - FilePath = @"", - LineNumber = 58, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.ImplicitConversion(global::TUnit.Core.Helpers.CastHelper.Cast>(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool.UseRuntimeDataGeneration(testSessionId); + var metadata_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool = new global::TUnit.Core.TestMetadata { TestName = "ExcludingAutoGeneratedMatrixValues", TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "ExcludingAutoGeneratedMatrixValues", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -817,80 +439,17 @@ internal sealed class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrix Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.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.MatrixTests.ExcludingAutoGeneratedMatrixValues", - ClassName = "MatrixTests", - MethodName = "ExcludingAutoGeneratedMatrixValues", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.ExcludingAutoGeneratedMatrixValues", - FilePath = @"", - LineNumber = 67, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.ExcludingAutoGeneratedMatrixValues(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_Method1__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool.UseRuntimeDataGeneration(testSessionId); + var metadata_Method1__int = new global::TUnit.Core.TestMetadata { TestName = "Method1", TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Method1", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -931,80 +490,17 @@ internal sealed class TUnit_TestProject_MatrixTests_Method1__int_TestSource : gl Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.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.MatrixTests.Method1", - ClassName = "MatrixTests", - MethodName = "Method1", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method1", - FilePath = @"", - LineNumber = 116, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Method1__int, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Method1(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_Method2__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_Method1__int.UseRuntimeDataGeneration(testSessionId); + var metadata_Method2__int = new global::TUnit.Core.TestMetadata { TestName = "Method2", TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Method2", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1045,72 +541,1267 @@ internal sealed class TUnit_TestProject_MatrixTests_Method2__int_TestSource : gl Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Method2__int, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor + metadata_Method2__int.UseRuntimeDataGeneration(testSessionId); + var metadata_Method3__int = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.MatrixTests.Method2", - ClassName = "MatrixTests", - MethodName = "Method2", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method2", + TestName = "Method3", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "Method3", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, FilePath = @"", - LineNumber = 124, - 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() - { + LineNumber = 132, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "Method3", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "item", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method3", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Method3__int, + }; + metadata_Method3__int.UseRuntimeDataGeneration(testSessionId); + var metadata_Method4__int = new global::TUnit.Core.TestMetadata + { + TestName = "Method4", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "Method4", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 140, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "Method4", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "item", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method4", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Method4__int, + }; + metadata_Method4__int.UseRuntimeDataGeneration(testSessionId); + var metadata_Exclusion__int_int = new global::TUnit.Core.TestMetadata + { + TestName = "Exclusion", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "Exclusion", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_1, + 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 = 0, + FilePath = @"", + LineNumber = 148, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "Exclusion", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "item", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Exclusion", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "item2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Exclusion", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Exclusion__int_int, + }; + metadata_Exclusion__int_int.UseRuntimeDataGeneration(testSessionId); + var metadata_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum = new global::TUnit.Core.TestMetadata + { + TestName = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 197, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "flag", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool), typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)) + { + Name = "enum", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool), typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum, + }; + metadata_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum.UseRuntimeDataGeneration(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 }; + } + public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + { + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.MatrixTest_One", + ClassName = "MatrixTests", + MethodName = "MatrixTest_One", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_One", + FilePath = @"", + LineNumber = 9, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_MatrixTest_One__string_int_bool + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.MatrixTest_Two", + ClassName = "MatrixTests", + MethodName = "MatrixTest_Two", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_Two", + FilePath = @"", + LineNumber = 19, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_MatrixTest_Two__int_int_int_bool + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.MatrixTest_Enum", + ClassName = "MatrixTests", + MethodName = "MatrixTest_Enum", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_Enum", + FilePath = @"", + LineNumber = 30, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_MatrixTest_Enum__int_TestEnum_TestEnum_ + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.AutoGenerateBools", + ClassName = "MatrixTests", + MethodName = "AutoGenerateBools", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.AutoGenerateBools", + FilePath = @"", + LineNumber = 40, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_AutoGenerateBools__string_bool + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.AutoGenerateBools2", + ClassName = "MatrixTests", + MethodName = "AutoGenerateBools2", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.AutoGenerateBools2", + FilePath = @"", + LineNumber = 49, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_AutoGenerateBools2__string_bool_ + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.ImplicitConversion", + ClassName = "MatrixTests", + MethodName = "ImplicitConversion", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.ImplicitConversion", + FilePath = @"", + LineNumber = 58, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.ExcludingAutoGeneratedMatrixValues", + ClassName = "MatrixTests", + MethodName = "ExcludingAutoGeneratedMatrixValues", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.ExcludingAutoGeneratedMatrixValues", + FilePath = @"", + LineNumber = 67, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.Method1", + ClassName = "MatrixTests", + MethodName = "Method1", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method1", + FilePath = @"", + LineNumber = 116, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Method1__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.Method2", + ClassName = "MatrixTests", + MethodName = "Method2", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method2", + FilePath = @"", + LineNumber = 124, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Method2__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.Method3", + ClassName = "MatrixTests", + MethodName = "Method3", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method3", + FilePath = @"", + LineNumber = 132, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Method3__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.Method4", + ClassName = "MatrixTests", + MethodName = "Method4", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method4", + FilePath = @"", + LineNumber = 140, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Method4__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.Exclusion", + ClassName = "MatrixTests", + MethodName = "Exclusion", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.Exclusion", + FilePath = @"", + LineNumber = 148, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Exclusion__int_int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", + ClassName = "MatrixTests", + MethodName = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", + FilePath = @"", + LineNumber = 197, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + 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(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + 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 metadata = new global::TUnit.Core.TestMetadata + { + TestName = "MatrixTest_One", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "MatrixTest_One", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 9, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTest_One", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "str", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(int), typeof(bool) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "i", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(int), typeof(bool) }, null)!.GetParameters()[1] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "boolean", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(int), typeof(bool) }, null)!.GetParameters()[2] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixTest_One__string_int_bool, + }; + metadata.UseRuntimeDataGeneration(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 metadata = new global::TUnit.Core.TestMetadata + { + TestName = "MatrixTest_Two", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "MatrixTest_Two", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 19, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTest_Two", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "i", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int), typeof(int), typeof(bool) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "i2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int), typeof(int), typeof(bool) }, null)!.GetParameters()[1] + }, + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "i3", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int), typeof(int), typeof(bool) }, null)!.GetParameters()[2] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "boolean", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int), typeof(int), typeof(bool) }, null)!.GetParameters()[3] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixTest_Two__int_int_int_bool, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_MatrixTest_Enum__int_TestEnum_TestEnum_(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "MatrixTest_Enum", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "MatrixTest_Enum", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 30, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTest_Enum", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "i", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Enum", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(TestEnum), typeof(TestEnum?) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(TestEnum)) + { + Name = "testEnum", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(TestEnum)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Enum", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(TestEnum), typeof(TestEnum?) }, null)!.GetParameters()[1] + }, + new global::TUnit.Core.ParameterMetadata(typeof(TestEnum?)) + { + Name = "testEnum2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(TestEnum?)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Enum", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(TestEnum), typeof(TestEnum?) }, null)!.GetParameters()[2] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixTest_Enum__int_TestEnum_TestEnum_, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_AutoGenerateBools__string_bool(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "AutoGenerateBools", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "AutoGenerateBools", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 40, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "AutoGenerateBools", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "str", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("AutoGenerateBools", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(bool) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "boolean", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("AutoGenerateBools", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(bool) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AutoGenerateBools__string_bool, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_AutoGenerateBools2__string_bool_(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "AutoGenerateBools2", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "AutoGenerateBools2", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 49, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "AutoGenerateBools2", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "str", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("AutoGenerateBools2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(bool?) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool?)) + { + Name = "boolean", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool?)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("AutoGenerateBools2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(bool?) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AutoGenerateBools2__string_bool_, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool(string testSessionId) { - try + var metadata = new global::TUnit.Core.TestMetadata { - switch (args.Length) + TestName = "ImplicitConversion", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "ImplicitConversion", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] { - case 1: + new global::TUnit.Core.MatrixDataSourceAttribute(), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 58, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "ImplicitConversion", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(OneOf)) { - return new global::System.Threading.Tasks.ValueTask(instance.Method2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + Name = "enum", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(OneOf)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("ImplicitConversion", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(OneOf), typeof(bool) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "boolean", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("ImplicitConversion", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(OneOf), typeof(bool) }, null)!.GetParameters()[1] } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) + }, + Class = 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } + TestName = "ExcludingAutoGeneratedMatrixValues", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "ExcludingAutoGeneratedMatrixValues", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 67, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "ExcludingAutoGeneratedMatrixValues", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)) + { + Name = "enum", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("ExcludingAutoGeneratedMatrixValues", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), typeof(bool) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "boolean", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("ExcludingAutoGeneratedMatrixValues", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), typeof(bool) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Method1__int(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "Method1", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "Method1", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 116, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "Method1", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "item", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method1", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Method1__int, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Method2__int(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "Method2", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "Method2", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 124, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "Method2", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "item", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Method2__int, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Method3__int(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -1118,7 +1809,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : gl TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Method3", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1159,72 +1850,13 @@ internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : gl Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Method3__int, }; 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.MatrixTests.Method3", - ClassName = "MatrixTests", - MethodName = "Method3", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method3", - FilePath = @"", - LineNumber = 132, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Method3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Method4__int(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -1232,7 +1864,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : gl TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Method4", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1273,72 +1905,13 @@ internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : gl Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Method4__int, }; 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.MatrixTests.Method4", - ClassName = "MatrixTests", - MethodName = "Method4", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method4", - FilePath = @"", - LineNumber = 140, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Method4(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Exclusion__int_int(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -1346,7 +1919,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSourc TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Exclusion", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_1, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1394,75 +1967,13 @@ internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSourc Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Exclusion__int_int, }; 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.MatrixTests.Exclusion", - ClassName = "MatrixTests", - MethodName = "Exclusion", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Exclusion", - FilePath = @"", - LineNumber = 148, - 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.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(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)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__boo_38BEEE8F_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -1470,7 +1981,7 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParamet TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1518,71 +2029,12 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParamet Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum, }; 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.MatrixTests.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", - ClassName = "MatrixTests", - MethodName = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", - FilePath = @"", - LineNumber = 197, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_MatrixTests__ClassHelper -{ internal static global::TUnit.TestProject.MatrixTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.MatrixTests(); @@ -1590,18 +2042,6 @@ internal static class TUnit_TestProject_MatrixTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_bool__TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bool_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__boo_38BEEE8F_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnum_TestEnum__TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_bool_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_bool_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Method1__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Method2__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Method3__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Method4__int_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests__TestSource()); } } 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 a140988e923..224e100f7dc 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 @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_MatrixTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_MatrixTest_One__string_int_bool = new global::TUnit.Core.TestMetadata { TestName = "MatrixTest_One", TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "MatrixTest_One", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -70,80 +70,17 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_b Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.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.MatrixTests.MatrixTest_One", - ClassName = "MatrixTests", - MethodName = "MatrixTest_One", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_One", - FilePath = @"", - LineNumber = 9, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixTest_One__string_int_bool, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 3: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_One(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_MatrixTest_One__string_int_bool.UseRuntimeDataGeneration(testSessionId); + var metadata_MatrixTest_Two__int_int_int_bool = new global::TUnit.Core.TestMetadata { TestName = "MatrixTest_Two", TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "MatrixTest_Two", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -205,80 +142,17 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_ Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.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.MatrixTests.MatrixTest_Two", - ClassName = "MatrixTests", - MethodName = "MatrixTest_Two", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_Two", - FilePath = @"", - LineNumber = 19, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixTest_Two__int_int_int_bool, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 4: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_Two(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 4 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnum_TestEnum__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_MatrixTest_Two__int_int_int_bool.UseRuntimeDataGeneration(testSessionId); + var metadata_MatrixTest_Enum__int_TestEnum_TestEnum_ = new global::TUnit.Core.TestMetadata { TestName = "MatrixTest_Enum", TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "MatrixTest_Enum", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -333,80 +207,17 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnu Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.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.MatrixTests.MatrixTest_Enum", - ClassName = "MatrixTests", - MethodName = "MatrixTest_Enum", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_Enum", - FilePath = @"", - LineNumber = 30, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixTest_Enum__int_TestEnum_TestEnum_, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 3: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_Enum(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_MatrixTest_Enum__int_TestEnum_TestEnum_.UseRuntimeDataGeneration(testSessionId); + var metadata_AutoGenerateBools__string_bool = new global::TUnit.Core.TestMetadata { TestName = "AutoGenerateBools", TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "AutoGenerateBools", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -454,80 +265,17 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bo Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.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.MatrixTests.AutoGenerateBools", - ClassName = "MatrixTests", - MethodName = "AutoGenerateBools", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.AutoGenerateBools", - FilePath = @"", - LineNumber = 40, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AutoGenerateBools__string_bool, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.AutoGenerateBools(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_bool__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_AutoGenerateBools__string_bool.UseRuntimeDataGeneration(testSessionId); + var metadata_AutoGenerateBools2__string_bool_ = new global::TUnit.Core.TestMetadata { TestName = "AutoGenerateBools2", TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "AutoGenerateBools2", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -575,72 +323,1251 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_b Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AutoGenerateBools2__string_bool_, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor + metadata_AutoGenerateBools2__string_bool_.UseRuntimeDataGeneration(testSessionId); + var metadata_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.MatrixTests.AutoGenerateBools2", - ClassName = "MatrixTests", - MethodName = "AutoGenerateBools2", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.AutoGenerateBools2", - FilePath = @"", - LineNumber = 49, - 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() + TestName = "ImplicitConversion", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "ImplicitConversion", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 58, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "ImplicitConversion", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(OneOf)) + { + Name = "enum", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(OneOf)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("ImplicitConversion", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(OneOf), typeof(bool) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "boolean", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("ImplicitConversion", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(OneOf), typeof(bool) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool, + }; + metadata_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool.UseRuntimeDataGeneration(testSessionId); + var metadata_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool = new global::TUnit.Core.TestMetadata + { + TestName = "ExcludingAutoGeneratedMatrixValues", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "ExcludingAutoGeneratedMatrixValues", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 67, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "ExcludingAutoGeneratedMatrixValues", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)) + { + Name = "enum", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("ExcludingAutoGeneratedMatrixValues", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), typeof(bool) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "boolean", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("ExcludingAutoGeneratedMatrixValues", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), typeof(bool) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool, + }; + metadata_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool.UseRuntimeDataGeneration(testSessionId); + var metadata_Method1__int = new global::TUnit.Core.TestMetadata + { + TestName = "Method1", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "Method1", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 116, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "Method1", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "item", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method1", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Method1__int, + }; + metadata_Method1__int.UseRuntimeDataGeneration(testSessionId); + var metadata_Method2__int = new global::TUnit.Core.TestMetadata + { + TestName = "Method2", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "Method2", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 124, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "Method2", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "item", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Method2__int, + }; + metadata_Method2__int.UseRuntimeDataGeneration(testSessionId); + var metadata_Method3__int = new global::TUnit.Core.TestMetadata + { + TestName = "Method3", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "Method3", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 132, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "Method3", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "item", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method3", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Method3__int, + }; + metadata_Method3__int.UseRuntimeDataGeneration(testSessionId); + var metadata_Method4__int = new global::TUnit.Core.TestMetadata + { + TestName = "Method4", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "Method4", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 140, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "Method4", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "item", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method4", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Method4__int, + }; + metadata_Method4__int.UseRuntimeDataGeneration(testSessionId); + var metadata_Exclusion__int_int = new global::TUnit.Core.TestMetadata + { + TestName = "Exclusion", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "Exclusion", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_1, + 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 = 0, + FilePath = @"", + LineNumber = 148, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "Exclusion", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "item", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Exclusion", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "item2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Exclusion", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Exclusion__int_int, + }; + metadata_Exclusion__int_int.UseRuntimeDataGeneration(testSessionId); + var metadata_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum = new global::TUnit.Core.TestMetadata + { + TestName = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 197, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "flag", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool), typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)) + { + Name = "enum", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool), typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum, + }; + metadata_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum.UseRuntimeDataGeneration(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 }; + } + public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + { + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.MatrixTest_One", + ClassName = "MatrixTests", + MethodName = "MatrixTest_One", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_One", + FilePath = @"", + LineNumber = 9, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_MatrixTest_One__string_int_bool + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.MatrixTest_Two", + ClassName = "MatrixTests", + MethodName = "MatrixTest_Two", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_Two", + FilePath = @"", + LineNumber = 19, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_MatrixTest_Two__int_int_int_bool + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.MatrixTest_Enum", + ClassName = "MatrixTests", + MethodName = "MatrixTest_Enum", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_Enum", + FilePath = @"", + LineNumber = 30, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_MatrixTest_Enum__int_TestEnum_TestEnum_ + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.AutoGenerateBools", + ClassName = "MatrixTests", + MethodName = "AutoGenerateBools", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.AutoGenerateBools", + FilePath = @"", + LineNumber = 40, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_AutoGenerateBools__string_bool + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.AutoGenerateBools2", + ClassName = "MatrixTests", + MethodName = "AutoGenerateBools2", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.AutoGenerateBools2", + FilePath = @"", + LineNumber = 49, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_AutoGenerateBools2__string_bool_ + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.ImplicitConversion", + ClassName = "MatrixTests", + MethodName = "ImplicitConversion", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.ImplicitConversion", + FilePath = @"", + LineNumber = 58, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.ExcludingAutoGeneratedMatrixValues", + ClassName = "MatrixTests", + MethodName = "ExcludingAutoGeneratedMatrixValues", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.ExcludingAutoGeneratedMatrixValues", + FilePath = @"", + LineNumber = 67, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.Method1", + ClassName = "MatrixTests", + MethodName = "Method1", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method1", + FilePath = @"", + LineNumber = 116, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Method1__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.Method2", + ClassName = "MatrixTests", + MethodName = "Method2", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method2", + FilePath = @"", + LineNumber = 124, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Method2__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.Method3", + ClassName = "MatrixTests", + MethodName = "Method3", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method3", + FilePath = @"", + LineNumber = 132, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Method3__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.Method4", + ClassName = "MatrixTests", + MethodName = "Method4", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method4", + FilePath = @"", + LineNumber = 140, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Method4__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.Exclusion", + ClassName = "MatrixTests", + MethodName = "Exclusion", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.Exclusion", + FilePath = @"", + LineNumber = 148, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Exclusion__int_int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", + ClassName = "MatrixTests", + MethodName = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", + FilePath = @"", + LineNumber = 197, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + 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 metadata = new global::TUnit.Core.TestMetadata + { + TestName = "MatrixTest_One", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "MatrixTest_One", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 9, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTest_One", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "str", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(int), typeof(bool) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "i", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(int), typeof(bool) }, null)!.GetParameters()[1] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "boolean", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(int), typeof(bool) }, null)!.GetParameters()[2] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixTest_One__string_int_bool, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_MatrixTest_Two__int_int_int_bool(string testSessionId) { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "MatrixTest_Two", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "MatrixTest_Two", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 19, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTest_Two", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "i", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int), typeof(int), typeof(bool) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "i2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int), typeof(int), typeof(bool) }, null)!.GetParameters()[1] + }, + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "i3", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int), typeof(int), typeof(bool) }, null)!.GetParameters()[2] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "boolean", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int), typeof(int), typeof(bool) }, null)!.GetParameters()[3] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixTest_Two__int_int_int_bool, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_MatrixTest_Enum__int_TestEnum_TestEnum_(string testSessionId) { - try + var metadata = new global::TUnit.Core.TestMetadata { - switch (args.Length) + TestName = "MatrixTest_Enum", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "MatrixTest_Enum", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] { - case 2: + new global::TUnit.Core.MatrixDataSourceAttribute(), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 30, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTest_Enum", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "i", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Enum", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(TestEnum), typeof(TestEnum?) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(TestEnum)) + { + Name = "testEnum", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(TestEnum)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Enum", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(TestEnum), typeof(TestEnum?) }, null)!.GetParameters()[1] + }, + new global::TUnit.Core.ParameterMetadata(typeof(TestEnum?)) + { + Name = "testEnum2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(TestEnum?)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Enum", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(TestEnum), typeof(TestEnum?) }, null)!.GetParameters()[2] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixTest_Enum__int_TestEnum_TestEnum_, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_AutoGenerateBools__string_bool(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "AutoGenerateBools", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "AutoGenerateBools", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 40, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "AutoGenerateBools", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "str", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("AutoGenerateBools", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(bool) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "boolean", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("AutoGenerateBools", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(bool) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AutoGenerateBools__string_bool, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_AutoGenerateBools2__string_bool_(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "AutoGenerateBools2", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "AutoGenerateBools2", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 49, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "AutoGenerateBools2", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "str", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("AutoGenerateBools2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(bool?) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool?)) { - 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]))); + Name = "boolean", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool?)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("AutoGenerateBools2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(bool?) }, null)!.GetParameters()[1] } - 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)); - } + }, + Class = 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AutoGenerateBools2__string_bool_, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -648,7 +1575,7 @@ internal sealed class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_Te TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "ImplicitConversion", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -696,72 +1623,13 @@ internal sealed class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_Te Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool, }; 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.MatrixTests.ImplicitConversion", - ClassName = "MatrixTests", - MethodName = "ImplicitConversion", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.ImplicitConversion", - FilePath = @"", - LineNumber = 58, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.ImplicitConversion(global::TUnit.Core.Helpers.CastHelper.Cast>(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -769,7 +1637,7 @@ internal sealed class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrix TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "ExcludingAutoGeneratedMatrixValues", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -817,72 +1685,13 @@ internal sealed class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrix Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool, }; 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.MatrixTests.ExcludingAutoGeneratedMatrixValues", - ClassName = "MatrixTests", - MethodName = "ExcludingAutoGeneratedMatrixValues", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.ExcludingAutoGeneratedMatrixValues", - FilePath = @"", - LineNumber = 67, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.ExcludingAutoGeneratedMatrixValues(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_Method1__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Method1__int(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -890,7 +1699,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method1__int_TestSource : gl TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Method1", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -931,72 +1740,13 @@ internal sealed class TUnit_TestProject_MatrixTests_Method1__int_TestSource : gl Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Method1__int, }; 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.MatrixTests.Method1", - ClassName = "MatrixTests", - MethodName = "Method1", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method1", - FilePath = @"", - LineNumber = 116, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Method1(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_Method2__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Method2__int(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -1004,7 +1754,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method2__int_TestSource : gl TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Method2", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1029,88 +1779,29 @@ internal sealed class TUnit_TestProject_MatrixTests_Method2__int_TestSource : gl { Name = "item", TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] - } - }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 - }) - }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.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.MatrixTests.Method2", - ClassName = "MatrixTests", - MethodName = "Method2", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method2", - FilePath = @"", - LineNumber = 124, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Method2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } + }, + Class = 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Method2__int, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Method3__int(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -1118,7 +1809,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : gl TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Method3", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1159,72 +1850,13 @@ internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : gl Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Method3__int, }; 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.MatrixTests.Method3", - ClassName = "MatrixTests", - MethodName = "Method3", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method3", - FilePath = @"", - LineNumber = 132, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Method3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Method4__int(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -1232,7 +1864,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : gl TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Method4", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1273,72 +1905,13 @@ internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : gl Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Method4__int, }; 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.MatrixTests.Method4", - ClassName = "MatrixTests", - MethodName = "Method4", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method4", - FilePath = @"", - LineNumber = 140, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Method4(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Exclusion__int_int(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -1346,7 +1919,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSourc TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Exclusion", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_1, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1394,75 +1967,13 @@ internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSourc Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Exclusion__int_int, }; 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.MatrixTests.Exclusion", - ClassName = "MatrixTests", - MethodName = "Exclusion", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Exclusion", - FilePath = @"", - LineNumber = 148, - 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.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(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)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__boo_38BEEE8F_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -1470,7 +1981,7 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParamet TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1518,71 +2029,12 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParamet Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum, }; 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.MatrixTests.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", - ClassName = "MatrixTests", - MethodName = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", - FilePath = @"", - LineNumber = 197, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_MatrixTests__ClassHelper -{ internal static global::TUnit.TestProject.MatrixTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.MatrixTests(); @@ -1590,18 +2042,6 @@ internal static class TUnit_TestProject_MatrixTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_bool__TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bool_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__boo_38BEEE8F_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnum_TestEnum__TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_bool_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_bool_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Method1__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Method2__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Method3__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Method4__int_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests__TestSource()); } } 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 1086e4d1c16..08eb716621b 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 @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_DataSource_Method__int = new global::TUnit.Core.TestMetadata { TestName = "DataSource_Method", TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -67,81 +67,17 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.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.MethodDataSourceDrivenTests.DataSource_Method", - ClassName = "MethodDataSourceDrivenTests", - MethodName = "DataSource_Method", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method", - FilePath = @"", - LineNumber = 12, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method__int, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method2__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_Method__int.UseRuntimeDataGeneration(testSessionId); + var metadata_DataSource_Method2__int = new global::TUnit.Core.TestMetadata { TestName = "DataSource_Method2", TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method2", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -193,81 +129,17 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.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.MethodDataSourceDrivenTests.DataSource_Method2", - ClassName = "MethodDataSourceDrivenTests", - MethodName = "DataSource_Method2", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method2", - FilePath = @"", - LineNumber = 19, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method2__int, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method_WithAction__Action_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_Method2__int.UseRuntimeDataGeneration(testSessionId); + var metadata_DataSource_Method_WithAction__Action = new global::TUnit.Core.TestMetadata { TestName = "DataSource_Method_WithAction", TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method_WithAction", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeAction") @@ -319,81 +191,17 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.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.MethodDataSourceDrivenTests.DataSource_Method_WithAction", - ClassName = "MethodDataSourceDrivenTests", - MethodName = "DataSource_Method_WithAction", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method_WithAction", - FilePath = @"", - LineNumber = 26, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method_WithAction__Action, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method_WithAction(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method3__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_Method_WithAction__Action.UseRuntimeDataGeneration(testSessionId); + var metadata_DataSource_Method3__int = new global::TUnit.Core.TestMetadata { TestName = "DataSource_Method3", TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method3", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -460,81 +268,17 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.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.MethodDataSourceDrivenTests.DataSource_Method3", - ClassName = "MethodDataSourceDrivenTests", - MethodName = "DataSource_Method3", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method3", - FilePath = @"", - LineNumber = 33, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method3__int, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method4__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_Method3__int.UseRuntimeDataGeneration(testSessionId); + var metadata_DataSource_Method4__int = new global::TUnit.Core.TestMetadata { TestName = "DataSource_Method4", TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method4", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -628,81 +372,17 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method4__int, }; - 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.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 = GetTests - }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method4(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_WithBaseReturn__BaseValue_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_Method4__int.UseRuntimeDataGeneration(testSessionId); + var metadata_DataSource_WithBaseReturn__BaseValue = new global::TUnit.Core.TestMetadata { TestName = "DataSource_WithBaseReturn", TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_WithBaseReturn", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("MethodWithBaseReturn") @@ -754,81 +434,17 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_W Parent = null }) }, - InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.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.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 = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_WithBaseReturn__BaseValue, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_WithBaseReturn(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFuncArrayTest__string___TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_WithBaseReturn__BaseValue.UseRuntimeDataGeneration(testSessionId); + var metadata_EnumerableFuncArrayTest__string__ = new global::TUnit.Core.TestMetadata { TestName = "EnumerableFuncArrayTest", TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "EnumerableFuncArrayTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("EnumerableFuncArrayTestData") @@ -890,14 +506,104 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu Parent = null }) }, - InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_EnumerableFuncArrayTest__string__, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_EnumerableFuncArrayTest__string__.UseRuntimeDataGeneration(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__ }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method", + ClassName = "MethodDataSourceDrivenTests", + MethodName = "DataSource_Method", + FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method", + FilePath = @"", + LineNumber = 12, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_DataSource_Method__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method2", + ClassName = "MethodDataSourceDrivenTests", + MethodName = "DataSource_Method2", + FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method2", + FilePath = @"", + LineNumber = 19, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_DataSource_Method2__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method_WithAction", + ClassName = "MethodDataSourceDrivenTests", + MethodName = "DataSource_Method_WithAction", + FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method_WithAction", + FilePath = @"", + LineNumber = 26, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_DataSource_Method_WithAction__Action + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method3", + ClassName = "MethodDataSourceDrivenTests", + MethodName = "DataSource_Method3", + FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method3", + FilePath = @"", + LineNumber = 33, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + 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", @@ -911,10 +617,10 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_EnumerableFuncArrayTest__string__ }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -922,7 +628,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method__int(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -930,7 +636,8 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu { case 1: { - return new global::System.Threading.Tasks.ValueTask(instance.EnumerableFuncArrayTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + 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}"); @@ -941,20 +648,654 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper -{ + private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method2__int(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method_WithAction__Action(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method_WithAction(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method3__int(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method4__int(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method4(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_WithBaseReturn__BaseValue(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_WithBaseReturn(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest_EnumerableFuncArrayTest__string__(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.EnumerableFuncArrayTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method__int(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_Method", + TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TestMethodName = "DataSource_Method", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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(); + } + }, + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 12, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "DataSource_Method", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method__int, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method2__int(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_Method2", + TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TestMethodName = "DataSource_Method2", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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(); + } + }, + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 19, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "DataSource_Method2", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method2__int, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method_WithAction__Action(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_Method_WithAction", + TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TestMethodName = "DataSource_Method_WithAction", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = 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(); + } + }, + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 26, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "DataSource_Method_WithAction", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::System.Action)) + { + Name = "action", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Action)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method_WithAction", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Action) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method_WithAction__Action, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method3__int(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_Method3", + TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TestMethodName = "DataSource_Method3", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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(); + } + }, + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 33, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "DataSource_Method3", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method3", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method3__int, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method4__int(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_Method4", + TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TestMethodName = "DataSource_Method4", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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[] { "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) => + { + 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!", 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)); + } + return Factory(); + } + }, + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 42, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "DataSource_Method4", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method4", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method4__int, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_WithBaseReturn__BaseValue(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_WithBaseReturn", + TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TestMethodName = "DataSource_WithBaseReturn", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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.MethodDataSourceDrivenTests.MethodWithBaseReturn(); + 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(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 53, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "DataSource_WithBaseReturn", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_WithBaseReturn", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_WithBaseReturn__BaseValue, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_EnumerableFuncArrayTest__string__(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "EnumerableFuncArrayTest", + TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TestMethodName = "EnumerableFuncArrayTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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(); + } + }, + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 59, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "EnumerableFuncArrayTest", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string[])) + { + Name = "strings", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string[])), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("EnumerableFuncArrayTest", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string[]) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_EnumerableFuncArrayTest__string__, + }; + metadata.UseRuntimeDataGeneration(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(); @@ -962,12 +1303,6 @@ internal static class TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method2__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method3__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method4__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method_WithAction__Action_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_WithBaseReturn__BaseValue_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFuncArrayTest__string___TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests__TestSource()); } } 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 1086e4d1c16..08eb716621b 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 @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_DataSource_Method__int = new global::TUnit.Core.TestMetadata { TestName = "DataSource_Method", TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -67,81 +67,17 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.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.MethodDataSourceDrivenTests.DataSource_Method", - ClassName = "MethodDataSourceDrivenTests", - MethodName = "DataSource_Method", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method", - FilePath = @"", - LineNumber = 12, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method__int, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method2__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_Method__int.UseRuntimeDataGeneration(testSessionId); + var metadata_DataSource_Method2__int = new global::TUnit.Core.TestMetadata { TestName = "DataSource_Method2", TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method2", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -193,81 +129,17 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.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.MethodDataSourceDrivenTests.DataSource_Method2", - ClassName = "MethodDataSourceDrivenTests", - MethodName = "DataSource_Method2", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method2", - FilePath = @"", - LineNumber = 19, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method2__int, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method_WithAction__Action_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_Method2__int.UseRuntimeDataGeneration(testSessionId); + var metadata_DataSource_Method_WithAction__Action = new global::TUnit.Core.TestMetadata { TestName = "DataSource_Method_WithAction", TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method_WithAction", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeAction") @@ -319,81 +191,17 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.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.MethodDataSourceDrivenTests.DataSource_Method_WithAction", - ClassName = "MethodDataSourceDrivenTests", - MethodName = "DataSource_Method_WithAction", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method_WithAction", - FilePath = @"", - LineNumber = 26, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method_WithAction__Action, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method_WithAction(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method3__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_Method_WithAction__Action.UseRuntimeDataGeneration(testSessionId); + var metadata_DataSource_Method3__int = new global::TUnit.Core.TestMetadata { TestName = "DataSource_Method3", TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method3", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -460,81 +268,17 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.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.MethodDataSourceDrivenTests.DataSource_Method3", - ClassName = "MethodDataSourceDrivenTests", - MethodName = "DataSource_Method3", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method3", - FilePath = @"", - LineNumber = 33, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method3__int, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method4__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_Method3__int.UseRuntimeDataGeneration(testSessionId); + var metadata_DataSource_Method4__int = new global::TUnit.Core.TestMetadata { TestName = "DataSource_Method4", TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method4", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -628,81 +372,17 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method4__int, }; - 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.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 = GetTests - }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method4(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_WithBaseReturn__BaseValue_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_Method4__int.UseRuntimeDataGeneration(testSessionId); + var metadata_DataSource_WithBaseReturn__BaseValue = new global::TUnit.Core.TestMetadata { TestName = "DataSource_WithBaseReturn", TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_WithBaseReturn", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("MethodWithBaseReturn") @@ -754,81 +434,17 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_W Parent = null }) }, - InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.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.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 = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_WithBaseReturn__BaseValue, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_WithBaseReturn(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFuncArrayTest__string___TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_WithBaseReturn__BaseValue.UseRuntimeDataGeneration(testSessionId); + var metadata_EnumerableFuncArrayTest__string__ = new global::TUnit.Core.TestMetadata { TestName = "EnumerableFuncArrayTest", TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "EnumerableFuncArrayTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("EnumerableFuncArrayTestData") @@ -890,14 +506,104 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu Parent = null }) }, - InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_EnumerableFuncArrayTest__string__, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_EnumerableFuncArrayTest__string__.UseRuntimeDataGeneration(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__ }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method", + ClassName = "MethodDataSourceDrivenTests", + MethodName = "DataSource_Method", + FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method", + FilePath = @"", + LineNumber = 12, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_DataSource_Method__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method2", + ClassName = "MethodDataSourceDrivenTests", + MethodName = "DataSource_Method2", + FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method2", + FilePath = @"", + LineNumber = 19, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_DataSource_Method2__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method_WithAction", + ClassName = "MethodDataSourceDrivenTests", + MethodName = "DataSource_Method_WithAction", + FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method_WithAction", + FilePath = @"", + LineNumber = 26, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_DataSource_Method_WithAction__Action + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method3", + ClassName = "MethodDataSourceDrivenTests", + MethodName = "DataSource_Method3", + FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method3", + FilePath = @"", + LineNumber = 33, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + 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", @@ -911,10 +617,10 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_EnumerableFuncArrayTest__string__ }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -922,7 +628,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method__int(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -930,7 +636,8 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu { case 1: { - return new global::System.Threading.Tasks.ValueTask(instance.EnumerableFuncArrayTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + 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}"); @@ -941,20 +648,654 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper -{ + private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method2__int(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method_WithAction__Action(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method_WithAction(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method3__int(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method4__int(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method4(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_WithBaseReturn__BaseValue(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_WithBaseReturn(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest_EnumerableFuncArrayTest__string__(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.EnumerableFuncArrayTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method__int(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_Method", + TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TestMethodName = "DataSource_Method", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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(); + } + }, + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 12, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "DataSource_Method", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method__int, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method2__int(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_Method2", + TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TestMethodName = "DataSource_Method2", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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(); + } + }, + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 19, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "DataSource_Method2", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method2__int, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method_WithAction__Action(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_Method_WithAction", + TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TestMethodName = "DataSource_Method_WithAction", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = 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(); + } + }, + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 26, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "DataSource_Method_WithAction", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::System.Action)) + { + Name = "action", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Action)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method_WithAction", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Action) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method_WithAction__Action, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method3__int(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_Method3", + TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TestMethodName = "DataSource_Method3", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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(); + } + }, + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 33, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "DataSource_Method3", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method3", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method3__int, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method4__int(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_Method4", + TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TestMethodName = "DataSource_Method4", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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[] { "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) => + { + 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!", 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)); + } + return Factory(); + } + }, + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 42, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "DataSource_Method4", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method4", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method4__int, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_WithBaseReturn__BaseValue(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_WithBaseReturn", + TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TestMethodName = "DataSource_WithBaseReturn", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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.MethodDataSourceDrivenTests.MethodWithBaseReturn(); + 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(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 53, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "DataSource_WithBaseReturn", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_WithBaseReturn", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_WithBaseReturn__BaseValue, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_EnumerableFuncArrayTest__string__(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "EnumerableFuncArrayTest", + TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TestMethodName = "EnumerableFuncArrayTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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(); + } + }, + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 59, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "EnumerableFuncArrayTest", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string[])) + { + Name = "strings", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string[])), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("EnumerableFuncArrayTest", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string[]) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_EnumerableFuncArrayTest__string__, + }; + metadata.UseRuntimeDataGeneration(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(); @@ -962,12 +1303,6 @@ internal static class TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method2__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method3__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method4__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method_WithAction__Action_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_WithBaseReturn__BaseValue_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFuncArrayTest__string___TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests__TestSource()); } } 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 1086e4d1c16..08eb716621b 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 @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_DataSource_Method__int = new global::TUnit.Core.TestMetadata { TestName = "DataSource_Method", TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -67,81 +67,17 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.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.MethodDataSourceDrivenTests.DataSource_Method", - ClassName = "MethodDataSourceDrivenTests", - MethodName = "DataSource_Method", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method", - FilePath = @"", - LineNumber = 12, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method__int, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method2__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_Method__int.UseRuntimeDataGeneration(testSessionId); + var metadata_DataSource_Method2__int = new global::TUnit.Core.TestMetadata { TestName = "DataSource_Method2", TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method2", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -193,81 +129,17 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.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.MethodDataSourceDrivenTests.DataSource_Method2", - ClassName = "MethodDataSourceDrivenTests", - MethodName = "DataSource_Method2", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method2", - FilePath = @"", - LineNumber = 19, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method2__int, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method_WithAction__Action_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_Method2__int.UseRuntimeDataGeneration(testSessionId); + var metadata_DataSource_Method_WithAction__Action = new global::TUnit.Core.TestMetadata { TestName = "DataSource_Method_WithAction", TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method_WithAction", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeAction") @@ -319,81 +191,17 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.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.MethodDataSourceDrivenTests.DataSource_Method_WithAction", - ClassName = "MethodDataSourceDrivenTests", - MethodName = "DataSource_Method_WithAction", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method_WithAction", - FilePath = @"", - LineNumber = 26, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method_WithAction__Action, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method_WithAction(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method3__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_Method_WithAction__Action.UseRuntimeDataGeneration(testSessionId); + var metadata_DataSource_Method3__int = new global::TUnit.Core.TestMetadata { TestName = "DataSource_Method3", TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method3", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -460,81 +268,17 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.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.MethodDataSourceDrivenTests.DataSource_Method3", - ClassName = "MethodDataSourceDrivenTests", - MethodName = "DataSource_Method3", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method3", - FilePath = @"", - LineNumber = 33, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method3__int, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method4__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_Method3__int.UseRuntimeDataGeneration(testSessionId); + var metadata_DataSource_Method4__int = new global::TUnit.Core.TestMetadata { TestName = "DataSource_Method4", TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method4", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -628,81 +372,17 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method4__int, }; - 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.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 = GetTests - }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method4(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_WithBaseReturn__BaseValue_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_Method4__int.UseRuntimeDataGeneration(testSessionId); + var metadata_DataSource_WithBaseReturn__BaseValue = new global::TUnit.Core.TestMetadata { TestName = "DataSource_WithBaseReturn", TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_WithBaseReturn", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("MethodWithBaseReturn") @@ -754,81 +434,17 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_W Parent = null }) }, - InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.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.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 = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_WithBaseReturn__BaseValue, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_WithBaseReturn(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFuncArrayTest__string___TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_WithBaseReturn__BaseValue.UseRuntimeDataGeneration(testSessionId); + var metadata_EnumerableFuncArrayTest__string__ = new global::TUnit.Core.TestMetadata { TestName = "EnumerableFuncArrayTest", TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "EnumerableFuncArrayTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("EnumerableFuncArrayTestData") @@ -890,14 +506,104 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu Parent = null }) }, - InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_EnumerableFuncArrayTest__string__, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_EnumerableFuncArrayTest__string__.UseRuntimeDataGeneration(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__ }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method", + ClassName = "MethodDataSourceDrivenTests", + MethodName = "DataSource_Method", + FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method", + FilePath = @"", + LineNumber = 12, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_DataSource_Method__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method2", + ClassName = "MethodDataSourceDrivenTests", + MethodName = "DataSource_Method2", + FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method2", + FilePath = @"", + LineNumber = 19, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_DataSource_Method2__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method_WithAction", + ClassName = "MethodDataSourceDrivenTests", + MethodName = "DataSource_Method_WithAction", + FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method_WithAction", + FilePath = @"", + LineNumber = 26, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_DataSource_Method_WithAction__Action + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method3", + ClassName = "MethodDataSourceDrivenTests", + MethodName = "DataSource_Method3", + FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method3", + FilePath = @"", + LineNumber = 33, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + 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", @@ -911,10 +617,10 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_EnumerableFuncArrayTest__string__ }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -922,7 +628,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method__int(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -930,7 +636,8 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu { case 1: { - return new global::System.Threading.Tasks.ValueTask(instance.EnumerableFuncArrayTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + 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}"); @@ -941,20 +648,654 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper -{ + private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method2__int(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method_WithAction__Action(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method_WithAction(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method3__int(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method4__int(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method4(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_WithBaseReturn__BaseValue(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_WithBaseReturn(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest_EnumerableFuncArrayTest__string__(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.EnumerableFuncArrayTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method__int(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_Method", + TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TestMethodName = "DataSource_Method", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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(); + } + }, + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 12, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "DataSource_Method", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method__int, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method2__int(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_Method2", + TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TestMethodName = "DataSource_Method2", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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(); + } + }, + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 19, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "DataSource_Method2", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method2__int, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method_WithAction__Action(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_Method_WithAction", + TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TestMethodName = "DataSource_Method_WithAction", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = 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(); + } + }, + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 26, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "DataSource_Method_WithAction", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::System.Action)) + { + Name = "action", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Action)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method_WithAction", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Action) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method_WithAction__Action, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method3__int(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_Method3", + TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TestMethodName = "DataSource_Method3", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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(); + } + }, + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 33, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "DataSource_Method3", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method3", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method3__int, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method4__int(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_Method4", + TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TestMethodName = "DataSource_Method4", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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[] { "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) => + { + 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!", 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)); + } + return Factory(); + } + }, + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 42, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "DataSource_Method4", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method4", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method4__int, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_WithBaseReturn__BaseValue(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_WithBaseReturn", + TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TestMethodName = "DataSource_WithBaseReturn", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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.MethodDataSourceDrivenTests.MethodWithBaseReturn(); + 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(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 53, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "DataSource_WithBaseReturn", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_WithBaseReturn", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_WithBaseReturn__BaseValue, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_EnumerableFuncArrayTest__string__(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "EnumerableFuncArrayTest", + TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TestMethodName = "EnumerableFuncArrayTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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(); + } + }, + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 59, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "EnumerableFuncArrayTest", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string[])) + { + Name = "strings", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string[])), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("EnumerableFuncArrayTest", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string[]) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_EnumerableFuncArrayTest__string__, + }; + metadata.UseRuntimeDataGeneration(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(); @@ -962,12 +1303,6 @@ internal static class TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method2__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method3__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method4__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method_WithAction__Action_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_WithBaseReturn__BaseValue_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFuncArrayTest__string___TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests__TestSource()); } } 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 015f7286d95..7cf3b00ffc1 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 @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_DataSource_Method__int = new global::TUnit.Core.TestMetadata { TestName = "DataSource_Method", TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -67,81 +67,17 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.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.MethodDataSourceDrivenTests.DataSource_Method", - ClassName = "MethodDataSourceDrivenTests", - MethodName = "DataSource_Method", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method", - FilePath = @"", - LineNumber = 12, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method__int, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method2__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_Method__int.UseRuntimeDataGeneration(testSessionId); + var metadata_DataSource_Method2__int = new global::TUnit.Core.TestMetadata { TestName = "DataSource_Method2", TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method2", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -193,81 +129,17 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.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.MethodDataSourceDrivenTests.DataSource_Method2", - ClassName = "MethodDataSourceDrivenTests", - MethodName = "DataSource_Method2", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method2", - FilePath = @"", - LineNumber = 19, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method2__int, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method_WithAction__Action_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_Method2__int.UseRuntimeDataGeneration(testSessionId); + var metadata_DataSource_Method_WithAction__Action = new global::TUnit.Core.TestMetadata { TestName = "DataSource_Method_WithAction", TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method_WithAction", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeAction") @@ -319,81 +191,17 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.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.MethodDataSourceDrivenTests.DataSource_Method_WithAction", - ClassName = "MethodDataSourceDrivenTests", - MethodName = "DataSource_Method_WithAction", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method_WithAction", - FilePath = @"", - LineNumber = 26, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method_WithAction__Action, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method_WithAction(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method3__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_Method_WithAction__Action.UseRuntimeDataGeneration(testSessionId); + var metadata_DataSource_Method3__int = new global::TUnit.Core.TestMetadata { TestName = "DataSource_Method3", TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method3", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -460,81 +268,17 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.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.MethodDataSourceDrivenTests.DataSource_Method3", - ClassName = "MethodDataSourceDrivenTests", - MethodName = "DataSource_Method3", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method3", - FilePath = @"", - LineNumber = 33, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method3__int, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method4__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_Method3__int.UseRuntimeDataGeneration(testSessionId); + var metadata_DataSource_Method4__int = new global::TUnit.Core.TestMetadata { TestName = "DataSource_Method4", TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method4", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -628,81 +372,17 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method4__int, }; - 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.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 = GetTests - }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method4(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_WithBaseReturn__BaseValue_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_Method4__int.UseRuntimeDataGeneration(testSessionId); + var metadata_DataSource_WithBaseReturn__BaseValue = new global::TUnit.Core.TestMetadata { TestName = "DataSource_WithBaseReturn", TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_WithBaseReturn", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("MethodWithBaseReturn") @@ -754,81 +434,17 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_W Parent = null }) }, - InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.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.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 = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_WithBaseReturn__BaseValue, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_WithBaseReturn(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFuncArrayTest__string___TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_WithBaseReturn__BaseValue.UseRuntimeDataGeneration(testSessionId); + var metadata_EnumerableFuncArrayTest__string__ = new global::TUnit.Core.TestMetadata { TestName = "EnumerableFuncArrayTest", TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "EnumerableFuncArrayTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("EnumerableFuncArrayTestData") @@ -890,14 +506,104 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu Parent = null }) }, - InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_EnumerableFuncArrayTest__string__, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_EnumerableFuncArrayTest__string__.UseRuntimeDataGeneration(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__ }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method", + ClassName = "MethodDataSourceDrivenTests", + MethodName = "DataSource_Method", + FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method", + FilePath = @"", + LineNumber = 12, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_DataSource_Method__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method2", + ClassName = "MethodDataSourceDrivenTests", + MethodName = "DataSource_Method2", + FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method2", + FilePath = @"", + LineNumber = 19, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_DataSource_Method2__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method_WithAction", + ClassName = "MethodDataSourceDrivenTests", + MethodName = "DataSource_Method_WithAction", + FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method_WithAction", + FilePath = @"", + LineNumber = 26, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_DataSource_Method_WithAction__Action + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method3", + ClassName = "MethodDataSourceDrivenTests", + MethodName = "DataSource_Method3", + FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method3", + FilePath = @"", + LineNumber = 33, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + 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", @@ -911,10 +617,10 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_EnumerableFuncArrayTest__string__ }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -922,7 +628,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method__int(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -930,7 +636,8 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu { case 1: { - return new global::System.Threading.Tasks.ValueTask(instance.EnumerableFuncArrayTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + 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}"); @@ -941,20 +648,654 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper -{ + private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method2__int(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method_WithAction__Action(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method_WithAction(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method3__int(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method4__int(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method4(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_WithBaseReturn__BaseValue(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_WithBaseReturn(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest_EnumerableFuncArrayTest__string__(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.EnumerableFuncArrayTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method__int(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_Method", + TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TestMethodName = "DataSource_Method", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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(); + } + }, + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 12, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "DataSource_Method", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method__int, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method2__int(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_Method2", + TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TestMethodName = "DataSource_Method2", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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(); + } + }, + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 19, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "DataSource_Method2", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method2__int, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method_WithAction__Action(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_Method_WithAction", + TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TestMethodName = "DataSource_Method_WithAction", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = 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(); + } + }, + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 26, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "DataSource_Method_WithAction", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::System.Action)) + { + Name = "action", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Action)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method_WithAction", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Action) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method_WithAction__Action, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method3__int(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_Method3", + TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TestMethodName = "DataSource_Method3", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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(); + } + }, + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 33, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "DataSource_Method3", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method3", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method3__int, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method4__int(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_Method4", + TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TestMethodName = "DataSource_Method4", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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[] { "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) => + { + 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!", 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)); + } + return Factory(); + } + }, + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 42, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "DataSource_Method4", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method4", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method4__int, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_WithBaseReturn__BaseValue(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_WithBaseReturn", + TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TestMethodName = "DataSource_WithBaseReturn", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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.MethodDataSourceDrivenTests.MethodWithBaseReturn(); + 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(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 53, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "DataSource_WithBaseReturn", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_WithBaseReturn", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_WithBaseReturn__BaseValue, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_EnumerableFuncArrayTest__string__(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "EnumerableFuncArrayTest", + TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TestMethodName = "EnumerableFuncArrayTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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(); + } + }, + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 59, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "EnumerableFuncArrayTest", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string[])) + { + Name = "strings", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string[])), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("EnumerableFuncArrayTest", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string[]) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_EnumerableFuncArrayTest__string__, + }; + metadata.UseRuntimeDataGeneration(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(); @@ -962,12 +1303,6 @@ internal static class TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method2__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method3__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method4__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method_WithAction__Action_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_WithBaseReturn__BaseValue_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFuncArrayTest__string___TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests__TestSource()); } } 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 dec1759c857..3bb043f3de9 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 @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_TupleMethod__int_string_bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_DataSource_TupleMethod__int_string_bool = new global::TUnit.Core.TestMetadata { TestName = "DataSource_TupleMethod", TestClassType = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), TestMethodName = "DataSource_TupleMethod", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") @@ -81,11 +81,11 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu Parent = null }) }, - InstanceFactory = TUnit_TestProject_TupleDataSourceDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_TupleMethod__int_string_bool, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_DataSource_TupleMethod__int_string_bool.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_DataSource_TupleMethod__int_string_bool }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -102,10 +102,10 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_DataSource_TupleMethod__int_string_bool }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -113,7 +113,7 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.TupleDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + 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) { try { @@ -133,20 +133,86 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_TupleDataSourceDrivenTests__ClassHelper -{ + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_TupleMethod__int_string_bool(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_TupleMethod", + TestClassType = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), + TestMethodName = "DataSource_TupleMethod", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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(); + } + }, + }, + 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 + { + Type = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests)), + Name = "DataSource_TupleMethod", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.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] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "value2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string), typeof(bool) }, null)!.GetParameters()[1] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "value3", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string), typeof(bool) }, null)!.GetParameters()[2] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TupleDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_TupleMethod__int_string_bool, + }; + metadata.UseRuntimeDataGeneration(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(); @@ -154,6 +220,6 @@ internal static class TUnit_TestProject_TupleDataSourceDrivenTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), new TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_TupleMethod__int_string_bool_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), new TUnit_TestProject_TupleDataSourceDrivenTests__TestSource()); } } 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 dec1759c857..3bb043f3de9 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 @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_TupleMethod__int_string_bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_DataSource_TupleMethod__int_string_bool = new global::TUnit.Core.TestMetadata { TestName = "DataSource_TupleMethod", TestClassType = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), TestMethodName = "DataSource_TupleMethod", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") @@ -81,11 +81,11 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu Parent = null }) }, - InstanceFactory = TUnit_TestProject_TupleDataSourceDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_TupleMethod__int_string_bool, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_DataSource_TupleMethod__int_string_bool.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_DataSource_TupleMethod__int_string_bool }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -102,10 +102,10 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_DataSource_TupleMethod__int_string_bool }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -113,7 +113,7 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.TupleDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + 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) { try { @@ -133,20 +133,86 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_TupleDataSourceDrivenTests__ClassHelper -{ + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_TupleMethod__int_string_bool(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_TupleMethod", + TestClassType = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), + TestMethodName = "DataSource_TupleMethod", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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(); + } + }, + }, + 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 + { + Type = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests)), + Name = "DataSource_TupleMethod", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.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] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "value2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string), typeof(bool) }, null)!.GetParameters()[1] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "value3", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string), typeof(bool) }, null)!.GetParameters()[2] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TupleDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_TupleMethod__int_string_bool, + }; + metadata.UseRuntimeDataGeneration(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(); @@ -154,6 +220,6 @@ internal static class TUnit_TestProject_TupleDataSourceDrivenTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), new TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_TupleMethod__int_string_bool_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), new TUnit_TestProject_TupleDataSourceDrivenTests__TestSource()); } } 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 dec1759c857..3bb043f3de9 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 @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_TupleMethod__int_string_bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_DataSource_TupleMethod__int_string_bool = new global::TUnit.Core.TestMetadata { TestName = "DataSource_TupleMethod", TestClassType = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), TestMethodName = "DataSource_TupleMethod", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") @@ -81,11 +81,11 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu Parent = null }) }, - InstanceFactory = TUnit_TestProject_TupleDataSourceDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_TupleMethod__int_string_bool, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_DataSource_TupleMethod__int_string_bool.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_DataSource_TupleMethod__int_string_bool }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -102,10 +102,10 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_DataSource_TupleMethod__int_string_bool }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -113,7 +113,7 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.TupleDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + 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) { try { @@ -133,20 +133,86 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_TupleDataSourceDrivenTests__ClassHelper -{ + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_TupleMethod__int_string_bool(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_TupleMethod", + TestClassType = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), + TestMethodName = "DataSource_TupleMethod", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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(); + } + }, + }, + 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 + { + Type = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests)), + Name = "DataSource_TupleMethod", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.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] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "value2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string), typeof(bool) }, null)!.GetParameters()[1] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "value3", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string), typeof(bool) }, null)!.GetParameters()[2] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TupleDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_TupleMethod__int_string_bool, + }; + metadata.UseRuntimeDataGeneration(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(); @@ -154,6 +220,6 @@ internal static class TUnit_TestProject_TupleDataSourceDrivenTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), new TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_TupleMethod__int_string_bool_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), new TUnit_TestProject_TupleDataSourceDrivenTests__TestSource()); } } 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 acd322552d2..b31e6f9de35 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 @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_TupleMethod__int_string_bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_DataSource_TupleMethod__int_string_bool = new global::TUnit.Core.TestMetadata { TestName = "DataSource_TupleMethod", TestClassType = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), TestMethodName = "DataSource_TupleMethod", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") @@ -81,11 +81,11 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu Parent = null }) }, - InstanceFactory = TUnit_TestProject_TupleDataSourceDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_TupleMethod__int_string_bool, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_DataSource_TupleMethod__int_string_bool.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_DataSource_TupleMethod__int_string_bool }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -102,10 +102,10 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_DataSource_TupleMethod__int_string_bool }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -113,7 +113,7 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.TupleDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + 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) { try { @@ -133,20 +133,86 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_TupleDataSourceDrivenTests__ClassHelper -{ + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_TupleMethod__int_string_bool(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_TupleMethod", + TestClassType = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), + TestMethodName = "DataSource_TupleMethod", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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(); + } + }, + }, + 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 + { + Type = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests)), + Name = "DataSource_TupleMethod", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.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] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "value2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string), typeof(bool) }, null)!.GetParameters()[1] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "value3", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string), typeof(bool) }, null)!.GetParameters()[2] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TupleDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_TupleMethod__int_string_bool, + }; + metadata.UseRuntimeDataGeneration(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(); @@ -154,6 +220,6 @@ internal static class TUnit_TestProject_TupleDataSourceDrivenTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), new TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_TupleMethod__int_string_bool_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), new TUnit_TestProject_TupleDataSourceDrivenTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/ConstantArgumentsTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConstantArgumentsTests.Test.verified.txt index bdf5acaee62..f126e489c3a 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConstantArgumentsTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConstantArgumentsTests.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_ConstantArgumentsTests_String1__string_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_ConstantArgumentsTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_String1__string = new global::TUnit.Core.TestMetadata { TestName = "String1", TestClassType = typeof(global::TUnit.TestProject.ConstantArgumentsTests), TestMethodName = "String1", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("123"), @@ -56,80 +56,17 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_String1__string_T Parent = null }) }, - InstanceFactory = TUnit_TestProject_ConstantArgumentsTests__ClassHelper.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.ConstantArgumentsTests.String1", - ClassName = "ConstantArgumentsTests", - MethodName = "String1", - FullyQualifiedName = "TUnit.TestProject.ConstantArgumentsTests.String1", - FilePath = @"", - LineNumber = 16, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_String1__string, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ConstantArgumentsTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.String1(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_ConstantArgumentsTests_Int__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_String1__string.UseRuntimeDataGeneration(testSessionId); + var metadata_Int__int = new global::TUnit.Core.TestMetadata { TestName = "Int", TestClassType = typeof(global::TUnit.TestProject.ConstantArgumentsTests), TestMethodName = "Int", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(123), @@ -170,80 +107,17 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_Int__int_TestSour Parent = null }) }, - InstanceFactory = TUnit_TestProject_ConstantArgumentsTests__ClassHelper.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.ConstantArgumentsTests.Int", - ClassName = "ConstantArgumentsTests", - MethodName = "Int", - FullyQualifiedName = "TUnit.TestProject.ConstantArgumentsTests.Int", - FilePath = @"", - LineNumber = 23, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Int__int, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ConstantArgumentsTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Int(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_ConstantArgumentsTests_Double__double_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_Int__int.UseRuntimeDataGeneration(testSessionId); + var metadata_Double__double = new global::TUnit.Core.TestMetadata { TestName = "Double", TestClassType = typeof(global::TUnit.TestProject.ConstantArgumentsTests), TestMethodName = "Double", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1.23d), @@ -284,80 +158,17 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_Double__double_Te Parent = null }) }, - InstanceFactory = TUnit_TestProject_ConstantArgumentsTests__ClassHelper.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.ConstantArgumentsTests.Double", - ClassName = "ConstantArgumentsTests", - MethodName = "Double", - FullyQualifiedName = "TUnit.TestProject.ConstantArgumentsTests.Double", - FilePath = @"", - LineNumber = 30, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Double__double, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ConstantArgumentsTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Double(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_ConstantArgumentsTests_Float__float_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_Double__double.UseRuntimeDataGeneration(testSessionId); + var metadata_Float__float = new global::TUnit.Core.TestMetadata { TestName = "Float", TestClassType = typeof(global::TUnit.TestProject.ConstantArgumentsTests), TestMethodName = "Float", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1.23000002f), @@ -398,80 +209,17 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_Float__float_Test Parent = null }) }, - InstanceFactory = TUnit_TestProject_ConstantArgumentsTests__ClassHelper.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.ConstantArgumentsTests.Float", - ClassName = "ConstantArgumentsTests", - MethodName = "Float", - FullyQualifiedName = "TUnit.TestProject.ConstantArgumentsTests.Float", - FilePath = @"", - LineNumber = 37, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Float__float, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ConstantArgumentsTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Float(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_ConstantArgumentsTests_Long__long_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_Float__float.UseRuntimeDataGeneration(testSessionId); + var metadata_Long__long = new global::TUnit.Core.TestMetadata { TestName = "Long", TestClassType = typeof(global::TUnit.TestProject.ConstantArgumentsTests), TestMethodName = "Long", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(123L), @@ -512,80 +260,17 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_Long__long_TestSo Parent = null }) }, - InstanceFactory = TUnit_TestProject_ConstantArgumentsTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Long__long, }; - 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.ConstantArgumentsTests.Long", - ClassName = "ConstantArgumentsTests", - MethodName = "Long", - FullyQualifiedName = "TUnit.TestProject.ConstantArgumentsTests.Long", - FilePath = @"", - LineNumber = 44, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ConstantArgumentsTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Long(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_ConstantArgumentsTests_UInt__uint_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_Long__long.UseRuntimeDataGeneration(testSessionId); + var metadata_UInt__uint = new global::TUnit.Core.TestMetadata { TestName = "UInt", TestClassType = typeof(global::TUnit.TestProject.ConstantArgumentsTests), TestMethodName = "UInt", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(123U), @@ -626,80 +311,17 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_UInt__uint_TestSo Parent = null }) }, - InstanceFactory = TUnit_TestProject_ConstantArgumentsTests__ClassHelper.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.ConstantArgumentsTests.UInt", - ClassName = "ConstantArgumentsTests", - MethodName = "UInt", - FullyQualifiedName = "TUnit.TestProject.ConstantArgumentsTests.UInt", - FilePath = @"", - LineNumber = 51, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_UInt__uint, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ConstantArgumentsTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.UInt(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_ConstantArgumentsTests_ULong__ulong_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_UInt__uint.UseRuntimeDataGeneration(testSessionId); + var metadata_ULong__ulong = new global::TUnit.Core.TestMetadata { TestName = "ULong", TestClassType = typeof(global::TUnit.TestProject.ConstantArgumentsTests), TestMethodName = "ULong", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(123UL), @@ -740,14 +362,104 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_ULong__ulong_Test Parent = null }) }, - InstanceFactory = TUnit_TestProject_ConstantArgumentsTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ULong__ulong, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_ULong__ulong.UseRuntimeDataGeneration(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 }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.ConstantArgumentsTests.String1", + ClassName = "ConstantArgumentsTests", + MethodName = "String1", + FullyQualifiedName = "TUnit.TestProject.ConstantArgumentsTests.String1", + FilePath = @"", + LineNumber = 16, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_String1__string + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.ConstantArgumentsTests.Int", + ClassName = "ConstantArgumentsTests", + MethodName = "Int", + FullyQualifiedName = "TUnit.TestProject.ConstantArgumentsTests.Int", + FilePath = @"", + LineNumber = 23, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Int__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.ConstantArgumentsTests.Double", + ClassName = "ConstantArgumentsTests", + MethodName = "Double", + FullyQualifiedName = "TUnit.TestProject.ConstantArgumentsTests.Double", + FilePath = @"", + LineNumber = 30, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Double__double + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.ConstantArgumentsTests.Float", + ClassName = "ConstantArgumentsTests", + MethodName = "Float", + FullyQualifiedName = "TUnit.TestProject.ConstantArgumentsTests.Float", + FilePath = @"", + LineNumber = 37, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Float__float + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.ConstantArgumentsTests.Long", + ClassName = "ConstantArgumentsTests", + MethodName = "Long", + FullyQualifiedName = "TUnit.TestProject.ConstantArgumentsTests.Long", + FilePath = @"", + LineNumber = 44, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Long__long + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.ConstantArgumentsTests.UInt", + ClassName = "ConstantArgumentsTests", + MethodName = "UInt", + FullyQualifiedName = "TUnit.TestProject.ConstantArgumentsTests.UInt", + FilePath = @"", + LineNumber = 51, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_UInt__uint + }; yield return new global::TUnit.Core.TestDescriptor { TestId = "TUnit.TestProject.ConstantArgumentsTests.ULong", @@ -761,10 +473,10 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_ULong__ulong_Test HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_ULong__ulong }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -772,7 +484,7 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_ULong__ulong_Test new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ConstantArgumentsTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_String1__string(global::TUnit.TestProject.ConstantArgumentsTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -780,7 +492,7 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_ULong__ulong_Test { case 1: { - return new global::System.Threading.Tasks.ValueTask(instance.ULong(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + 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}"); @@ -791,20 +503,505 @@ internal sealed class TUnit_TestProject_ConstantArgumentsTests_ULong__ulong_Test return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_ConstantArgumentsTests__ClassHelper -{ + 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 metadata = new global::TUnit.Core.TestMetadata + { + TestName = "String1", + TestClassType = typeof(global::TUnit.TestProject.ConstantArgumentsTests), + TestMethodName = "String1", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute("123"), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 16, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.ConstantArgumentsTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ConstantArgumentsTests)), + Name = "String1", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "dummy", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("String1", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ConstantArgumentsTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_String1__string, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Int__int(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "Int", + TestClassType = typeof(global::TUnit.TestProject.ConstantArgumentsTests), + TestMethodName = "Int", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(123), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 23, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.ConstantArgumentsTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ConstantArgumentsTests)), + Name = "Int", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "dummy", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("Int", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ConstantArgumentsTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Int__int, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Double__double(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "Double", + TestClassType = typeof(global::TUnit.TestProject.ConstantArgumentsTests), + TestMethodName = "Double", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(1.23d), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 30, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.ConstantArgumentsTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ConstantArgumentsTests)), + Name = "Double", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(double)) + { + Name = "dummy", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(double)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("Double", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(double) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ConstantArgumentsTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Double__double, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Float__float(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "Float", + TestClassType = typeof(global::TUnit.TestProject.ConstantArgumentsTests), + TestMethodName = "Float", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(1.23000002f), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 37, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.ConstantArgumentsTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ConstantArgumentsTests)), + Name = "Float", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(float)) + { + Name = "dummy", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(float)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("Float", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(float) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ConstantArgumentsTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Float__float, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Long__long(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "Long", + TestClassType = typeof(global::TUnit.TestProject.ConstantArgumentsTests), + TestMethodName = "Long", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(123L), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 44, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.ConstantArgumentsTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ConstantArgumentsTests)), + Name = "Long", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(long)) + { + Name = "dummy", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(long)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("Long", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(long) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ConstantArgumentsTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Long__long, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_UInt__uint(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "UInt", + TestClassType = typeof(global::TUnit.TestProject.ConstantArgumentsTests), + TestMethodName = "UInt", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(123U), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 51, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.ConstantArgumentsTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ConstantArgumentsTests)), + Name = "UInt", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(uint)) + { + Name = "dummy", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(uint)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("UInt", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(uint) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ConstantArgumentsTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_UInt__uint, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_ULong__ulong(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "ULong", + TestClassType = typeof(global::TUnit.TestProject.ConstantArgumentsTests), + TestMethodName = "ULong", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(123UL), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 58, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.ConstantArgumentsTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ConstantArgumentsTests)), + Name = "ULong", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(ulong)) + { + Name = "dummy", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(ulong)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ConstantArgumentsTests).GetMethod("ULong", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(ulong) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ConstantArgumentsTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ULong__ulong, + }; + metadata.UseRuntimeDataGeneration(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(); @@ -812,12 +1009,6 @@ internal static class TUnit_TestProject_ConstantArgumentsTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ConstantArgumentsTests), new TUnit_TestProject_ConstantArgumentsTests_Double__double_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ConstantArgumentsTests), new TUnit_TestProject_ConstantArgumentsTests_Float__float_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ConstantArgumentsTests), new TUnit_TestProject_ConstantArgumentsTests_Int__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ConstantArgumentsTests), new TUnit_TestProject_ConstantArgumentsTests_Long__long_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ConstantArgumentsTests), new TUnit_TestProject_ConstantArgumentsTests_String1__string_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ConstantArgumentsTests), new TUnit_TestProject_ConstantArgumentsTests_UInt__uint_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ConstantArgumentsTests), new TUnit_TestProject_ConstantArgumentsTests_ULong__ulong_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ConstantArgumentsTests), new TUnit_TestProject_ConstantArgumentsTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/ConstantInBaseClassTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConstantInBaseClassTests.Test.verified.txt index 9b70d3dd0b2..a18130ff5eb 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConstantInBaseClassTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConstantInBaseClassTests.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_Bugs__1432_ConstantInBaseClassTests_SomeTest__string_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_Bugs__1432_ConstantInBaseClassTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_SomeTest__string = new global::TUnit.Core.TestMetadata { TestName = "SomeTest", TestClassType = typeof(global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests), TestMethodName = "SomeTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("Value"), @@ -56,11 +56,11 @@ internal sealed class TUnit_TestProject_Bugs__1432_ConstantInBaseClassTests_Some Parent = null }) }, - InstanceFactory = TUnit_TestProject_Bugs__1432_ConstantInBaseClassTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SomeTest__string, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_SomeTest__string.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_SomeTest__string }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -77,10 +77,10 @@ internal sealed class TUnit_TestProject_Bugs__1432_ConstantInBaseClassTests_Some HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_SomeTest__string }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -88,7 +88,7 @@ internal sealed class TUnit_TestProject_Bugs__1432_ConstantInBaseClassTests_Some new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_SomeTest__string(global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -107,20 +107,61 @@ internal sealed class TUnit_TestProject_Bugs__1432_ConstantInBaseClassTests_Some return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_Bugs__1432_ConstantInBaseClassTests__ClassHelper -{ + private static global::System.Collections.Generic.IReadOnlyList __Materialize_SomeTest__string(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "SomeTest", + TestClassType = typeof(global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests), + TestMethodName = "SomeTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute("Value"), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 13, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests)), + Name = "SomeTest", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests).GetMethod("SomeTest", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SomeTest__string, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } internal static global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests(); @@ -128,6 +169,6 @@ internal static class TUnit_TestProject_Bugs__1432_ConstantInBaseClassTests__Cla [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests), new TUnit_TestProject_Bugs__1432_ConstantInBaseClassTests_SomeTest__string_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._1432.ConstantInBaseClassTests), new TUnit_TestProject_Bugs__1432_ConstantInBaseClassTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/ConstantsInInterpolatedStringsTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ConstantsInInterpolatedStringsTests.Test.verified.txt index 47aca73943f..f0b48d8fbeb 100644 --- a/TUnit.Core.SourceGenerator.Tests/ConstantsInInterpolatedStringsTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ConstantsInInterpolatedStringsTests.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_Bugs__1432_ConstantsInInterpolatedStringsTests_SomeTest__string_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_Bugs__1432_ConstantsInInterpolatedStringsTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_SomeTest__string = new global::TUnit.Core.TestMetadata { TestName = "SomeTest", TestClassType = typeof(global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests), TestMethodName = "SomeTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute($"{"Value"}1"), @@ -56,11 +56,11 @@ internal sealed class TUnit_TestProject_Bugs__1432_ConstantsInInterpolatedString Parent = null }) }, - InstanceFactory = TUnit_TestProject_Bugs__1432_ConstantsInInterpolatedStringsTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SomeTest__string, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_SomeTest__string.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_SomeTest__string }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -77,10 +77,10 @@ internal sealed class TUnit_TestProject_Bugs__1432_ConstantsInInterpolatedString HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_SomeTest__string }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -88,7 +88,7 @@ internal sealed class TUnit_TestProject_Bugs__1432_ConstantsInInterpolatedString new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_SomeTest__string(global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -107,20 +107,61 @@ internal sealed class TUnit_TestProject_Bugs__1432_ConstantsInInterpolatedString return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_Bugs__1432_ConstantsInInterpolatedStringsTests__ClassHelper -{ + private static global::System.Collections.Generic.IReadOnlyList __Materialize_SomeTest__string(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "SomeTest", + TestClassType = typeof(global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests), + TestMethodName = "SomeTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute($"{"Value"}1"), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 13, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests)), + Name = "SomeTest", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests).GetMethod("SomeTest", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SomeTest__string, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } internal static global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests(); @@ -128,6 +169,6 @@ internal static class TUnit_TestProject_Bugs__1432_ConstantsInInterpolatedString [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests), new TUnit_TestProject_Bugs__1432_ConstantsInInterpolatedStringsTests_SomeTest__string_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._1432.ConstantsInInterpolatedStringsTests), new TUnit_TestProject_Bugs__1432_ConstantsInInterpolatedStringsTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/CustomDisplayNameTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/CustomDisplayNameTests.Test.verified.txt index d4de91837e1..b1d59cff055 100644 --- a/TUnit.Core.SourceGenerator.Tests/CustomDisplayNameTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/CustomDisplayNameTests.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_CustomDisplayNameTests_Test_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_CustomDisplayNameTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_Test = new global::TUnit.Core.TestMetadata { TestName = "Test", TestClassType = typeof(global::TUnit.TestProject.CustomDisplayNameTests), TestMethodName = "Test", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -57,73 +57,17 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_Test_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_CustomDisplayNameTests__ClassHelper.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.CustomDisplayNameTests.Test", - ClassName = "CustomDisplayNameTests", - MethodName = "Test", - FullyQualifiedName = "TUnit.TestProject.CustomDisplayNameTests.Test", - FilePath = @"", - LineNumber = 11, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.DisplayNameAttribute("A super important test!"), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.CustomDisplayNameTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.Test()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_CustomDisplayNameTests_Test2_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_Test.UseRuntimeDataGeneration(testSessionId); + var metadata_Test2 = new global::TUnit.Core.TestMetadata { TestName = "Test2", TestClassType = typeof(global::TUnit.TestProject.CustomDisplayNameTests), TestMethodName = "Test2", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_1, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -165,73 +109,17 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_Test2_TestSource Parent = null }) }, - InstanceFactory = TUnit_TestProject_CustomDisplayNameTests__ClassHelper.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.CustomDisplayNameTests.Test2", - ClassName = "CustomDisplayNameTests", - MethodName = "Test2", - FullyQualifiedName = "TUnit.TestProject.CustomDisplayNameTests.Test2", - FilePath = @"", - LineNumber = 18, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test2, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.DisplayNameAttribute("Another super important test!"), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.CustomDisplayNameTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.Test2()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_CustomDisplayNameTests_Test3__string_int_bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_Test2.UseRuntimeDataGeneration(testSessionId); + var metadata_Test3__string_int_bool = new global::TUnit.Core.TestMetadata { TestName = "Test3", TestClassType = typeof(global::TUnit.TestProject.CustomDisplayNameTests), TestMethodName = "Test3", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_2, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("foo", 1, true), @@ -300,81 +188,17 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_Test3__string_int Parent = null }) }, - InstanceFactory = TUnit_TestProject_CustomDisplayNameTests__ClassHelper.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.CustomDisplayNameTests.Test3", - ClassName = "CustomDisplayNameTests", - MethodName = "Test3", - FullyQualifiedName = "TUnit.TestProject.CustomDisplayNameTests.Test3", - FilePath = @"", - LineNumber = 25, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test3__string_int_bool, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.DisplayNameAttribute("Test with: $value1 $value2 $value3!"), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.CustomDisplayNameTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 3: - { - return new global::System.Threading.Tasks.ValueTask(instance.Test3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_CustomDisplayNameTests_MethodDataSourceTest__string_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_Test3__string_int_bool.UseRuntimeDataGeneration(testSessionId); + var metadata_MethodDataSourceTest__string = new global::TUnit.Core.TestMetadata { TestName = "MethodDataSourceTest", TestClassType = typeof(global::TUnit.TestProject.CustomDisplayNameTests), TestMethodName = "MethodDataSourceTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_3, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("Method") @@ -439,81 +263,17 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_MethodDataSourceT Parent = null }) }, - InstanceFactory = TUnit_TestProject_CustomDisplayNameTests__ClassHelper.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.CustomDisplayNameTests.MethodDataSourceTest", - ClassName = "CustomDisplayNameTests", - MethodName = "MethodDataSourceTest", - FullyQualifiedName = "TUnit.TestProject.CustomDisplayNameTests.MethodDataSourceTest", - FilePath = @"", - LineNumber = 37, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MethodDataSourceTest__string, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.DisplayNameAttribute("Test using MethodDataSource"), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.CustomDisplayNameTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.MethodDataSourceTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_CustomDisplayNameTests_TestParameterNamePrefixBug__int_string_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_MethodDataSourceTest__string.UseRuntimeDataGeneration(testSessionId); + var metadata_TestParameterNamePrefixBug__int_string = new global::TUnit.Core.TestMetadata { TestName = "TestParameterNamePrefixBug", TestClassType = typeof(global::TUnit.TestProject.CustomDisplayNameTests), TestMethodName = "TestParameterNamePrefixBug", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_4, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(100, "Type1"), @@ -576,73 +336,915 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_TestParameterName Parent = null }) }, - InstanceFactory = TUnit_TestProject_CustomDisplayNameTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_TestParameterNamePrefixBug__int_string, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor + metadata_TestParameterNamePrefixBug__int_string.UseRuntimeDataGeneration(testSessionId); + var metadata_PasswordTest__string = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.CustomDisplayNameTests.TestParameterNamePrefixBug", - ClassName = "CustomDisplayNameTests", - MethodName = "TestParameterNamePrefixBug", - FullyQualifiedName = "TUnit.TestProject.CustomDisplayNameTests.TestParameterNamePrefixBug", + TestName = "PasswordTest", + TestClassType = typeof(global::TUnit.TestProject.CustomDisplayNameTests), + TestMethodName = "PasswordTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_5, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.TestProject.CustomDisplayNameTests.MyGenerator(), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", - LineNumber = 45, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, + LineNumber = 65, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.CustomDisplayNameTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.CustomDisplayNameTests)), + Name = "PasswordTest", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "password", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.CustomDisplayNameTests).GetMethod("PasswordTest", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.CustomDisplayNameTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_PasswordTest__string, + }; + metadata_PasswordTest__string.UseRuntimeDataGeneration(testSessionId); + var metadata_SameClassConstantTest = new global::TUnit.Core.TestMetadata + { + TestName = "SameClassConstantTest", + TestClassType = typeof(global::TUnit.TestProject.CustomDisplayNameTests), + TestMethodName = "SameClassConstantTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_6, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 72, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.CustomDisplayNameTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.CustomDisplayNameTests)), + Name = "SameClassConstantTest", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SameClassConstantTest, + }; + metadata_SameClassConstantTest.UseRuntimeDataGeneration(testSessionId); + var metadata_DifferentClassConstantTest = new global::TUnit.Core.TestMetadata + { + TestName = "DifferentClassConstantTest", + TestClassType = typeof(global::TUnit.TestProject.CustomDisplayNameTests), + TestMethodName = "DifferentClassConstantTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_6, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 79, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.CustomDisplayNameTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.CustomDisplayNameTests)), + Name = "DifferentClassConstantTest", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DifferentClassConstantTest, + }; + metadata_DifferentClassConstantTest.UseRuntimeDataGeneration(testSessionId); + var metadata_NestedClassConstantTest = new global::TUnit.Core.TestMetadata + { + TestName = "NestedClassConstantTest", + TestClassType = typeof(global::TUnit.TestProject.CustomDisplayNameTests), + TestMethodName = "NestedClassConstantTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_6, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 86, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.CustomDisplayNameTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.CustomDisplayNameTests)), + Name = "NestedClassConstantTest", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_NestedClassConstantTest, + }; + metadata_NestedClassConstantTest.UseRuntimeDataGeneration(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 }; + } + public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + { + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.CustomDisplayNameTests.Test", + ClassName = "CustomDisplayNameTests", + MethodName = "Test", + FullyQualifiedName = "TUnit.TestProject.CustomDisplayNameTests.Test", + FilePath = @"", + LineNumber = 11, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Test + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.CustomDisplayNameTests.Test2", + ClassName = "CustomDisplayNameTests", + MethodName = "Test2", + FullyQualifiedName = "TUnit.TestProject.CustomDisplayNameTests.Test2", + FilePath = @"", + LineNumber = 18, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Test2 + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.CustomDisplayNameTests.Test3", + ClassName = "CustomDisplayNameTests", + MethodName = "Test3", + FullyQualifiedName = "TUnit.TestProject.CustomDisplayNameTests.Test3", + FilePath = @"", + LineNumber = 25, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Test3__string_int_bool + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.CustomDisplayNameTests.MethodDataSourceTest", + ClassName = "CustomDisplayNameTests", + MethodName = "MethodDataSourceTest", + FullyQualifiedName = "TUnit.TestProject.CustomDisplayNameTests.MethodDataSourceTest", + FilePath = @"", + LineNumber = 37, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_MethodDataSourceTest__string + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.CustomDisplayNameTests.TestParameterNamePrefixBug", + ClassName = "CustomDisplayNameTests", + MethodName = "TestParameterNamePrefixBug", + FullyQualifiedName = "TUnit.TestProject.CustomDisplayNameTests.TestParameterNamePrefixBug", + FilePath = @"", + LineNumber = 45, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_TestParameterNamePrefixBug__int_string + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.CustomDisplayNameTests.PasswordTest", + ClassName = "CustomDisplayNameTests", + MethodName = "PasswordTest", + FullyQualifiedName = "TUnit.TestProject.CustomDisplayNameTests.PasswordTest", + FilePath = @"", + LineNumber = 65, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_PasswordTest__string + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.CustomDisplayNameTests.SameClassConstantTest", + ClassName = "CustomDisplayNameTests", + MethodName = "SameClassConstantTest", + FullyQualifiedName = "TUnit.TestProject.CustomDisplayNameTests.SameClassConstantTest", + FilePath = @"", + LineNumber = 72, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_SameClassConstantTest + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.CustomDisplayNameTests.DifferentClassConstantTest", + ClassName = "CustomDisplayNameTests", + MethodName = "DifferentClassConstantTest", + FullyQualifiedName = "TUnit.TestProject.CustomDisplayNameTests.DifferentClassConstantTest", + FilePath = @"", + LineNumber = 79, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_DifferentClassConstantTest + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.CustomDisplayNameTests.NestedClassConstantTest", + ClassName = "CustomDisplayNameTests", + MethodName = "NestedClassConstantTest", + FullyQualifiedName = "TUnit.TestProject.CustomDisplayNameTests.NestedClassConstantTest", + FilePath = @"", + LineNumber = 86, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + 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 metadata = new global::TUnit.Core.TestMetadata + { + TestName = "Test", + TestClassType = typeof(global::TUnit.TestProject.CustomDisplayNameTests), + TestMethodName = "Test", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 11, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.CustomDisplayNameTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.CustomDisplayNameTests)), + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test, }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test2(string testSessionId) { - 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) - ]; + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "Test2", + TestClassType = typeof(global::TUnit.TestProject.CustomDisplayNameTests), + TestMethodName = "Test2", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_1, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 18, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.CustomDisplayNameTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.CustomDisplayNameTests)), + Name = "Test2", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test2, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.CustomDisplayNameTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test3__string_int_bool(string testSessionId) { - try + var metadata = new global::TUnit.Core.TestMetadata { - switch (args.Length) + TestName = "Test3", + TestClassType = typeof(global::TUnit.TestProject.CustomDisplayNameTests), + TestMethodName = "Test3", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_2, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] { - case 2: + new global::TUnit.Core.ArgumentsAttribute("foo", 1, true), + new global::TUnit.Core.ArgumentsAttribute("bar", 2, false), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 25, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.CustomDisplayNameTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.CustomDisplayNameTests)), + Name = "Test3", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "value1", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.CustomDisplayNameTests).GetMethod("Test3", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(int), typeof(bool) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.CustomDisplayNameTests).GetMethod("Test3", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(int), typeof(bool) }, null)!.GetParameters()[1] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "value3", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.CustomDisplayNameTests).GetMethod("Test3", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(int), typeof(bool) }, null)!.GetParameters()[2] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.CustomDisplayNameTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test3__string_int_bool, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_MethodDataSourceTest__string(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "MethodDataSourceTest", + TestClassType = typeof(global::TUnit.TestProject.CustomDisplayNameTests), + TestMethodName = "MethodDataSourceTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_3, + 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(); + } + }, + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 37, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.CustomDisplayNameTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.CustomDisplayNameTests)), + Name = "MethodDataSourceTest", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "foo", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.CustomDisplayNameTests).GetMethod("MethodDataSourceTest", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.CustomDisplayNameTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MethodDataSourceTest__string, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_TestParameterNamePrefixBug__int_string(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "TestParameterNamePrefixBug", + TestClassType = typeof(global::TUnit.TestProject.CustomDisplayNameTests), + TestMethodName = "TestParameterNamePrefixBug", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_4, + 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"), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 45, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.CustomDisplayNameTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.CustomDisplayNameTests)), + Name = "TestParameterNamePrefixBug", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "someValue", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.CustomDisplayNameTests).GetMethod("TestParameterNamePrefixBug", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) { - 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]))); + Name = "someValueType", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.CustomDisplayNameTests).GetMethod("TestParameterNamePrefixBug", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string) }, null)!.GetParameters()[1] } - 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)); - } + }, + Class = 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_TestParameterNamePrefixBug__int_string, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_CustomDisplayNameTests_PasswordTest__string_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_PasswordTest__string(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -650,7 +1252,7 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_PasswordTest__str TestClassType = typeof(global::TUnit.TestProject.CustomDisplayNameTests), TestMethodName = "PasswordTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_5, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.TestProject.CustomDisplayNameTests.MyGenerator(), @@ -704,72 +1306,13 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_PasswordTest__str Parent = null }) }, - InstanceFactory = TUnit_TestProject_CustomDisplayNameTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_PasswordTest__string, }; 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.CustomDisplayNameTests.PasswordTest", - ClassName = "CustomDisplayNameTests", - MethodName = "PasswordTest", - FullyQualifiedName = "TUnit.TestProject.CustomDisplayNameTests.PasswordTest", - FilePath = @"", - LineNumber = 65, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.CustomDisplayNameTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.PasswordTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_CustomDisplayNameTests_SameClassConstantTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_SameClassConstantTest(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -777,7 +1320,7 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_SameClassConstant TestClassType = typeof(global::TUnit.TestProject.CustomDisplayNameTests), TestMethodName = "SameClassConstantTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_6, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -819,65 +1362,13 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_SameClassConstant Parent = null }) }, - InstanceFactory = TUnit_TestProject_CustomDisplayNameTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SameClassConstantTest, }; 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.CustomDisplayNameTests.SameClassConstantTest", - ClassName = "CustomDisplayNameTests", - MethodName = "SameClassConstantTest", - FullyQualifiedName = "TUnit.TestProject.CustomDisplayNameTests.SameClassConstantTest", - FilePath = @"", - LineNumber = 72, - 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.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(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)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_CustomDisplayNameTests_DifferentClassConstantTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DifferentClassConstantTest(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -885,7 +1376,7 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_DifferentClassCon TestClassType = typeof(global::TUnit.TestProject.CustomDisplayNameTests), TestMethodName = "DifferentClassConstantTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_6, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -927,65 +1418,13 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_DifferentClassCon Parent = null }) }, - InstanceFactory = TUnit_TestProject_CustomDisplayNameTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DifferentClassConstantTest, }; 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.CustomDisplayNameTests.DifferentClassConstantTest", - ClassName = "CustomDisplayNameTests", - MethodName = "DifferentClassConstantTest", - FullyQualifiedName = "TUnit.TestProject.CustomDisplayNameTests.DifferentClassConstantTest", - FilePath = @"", - LineNumber = 79, - 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.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(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)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_CustomDisplayNameTests_NestedClassConstantTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_NestedClassConstantTest(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -993,7 +1432,7 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_NestedClassConsta TestClassType = typeof(global::TUnit.TestProject.CustomDisplayNameTests), TestMethodName = "NestedClassConstantTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_6, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -1035,64 +1474,12 @@ internal sealed class TUnit_TestProject_CustomDisplayNameTests_NestedClassConsta Parent = null }) }, - InstanceFactory = TUnit_TestProject_CustomDisplayNameTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_NestedClassConstantTest, }; 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.CustomDisplayNameTests.NestedClassConstantTest", - ClassName = "CustomDisplayNameTests", - MethodName = "NestedClassConstantTest", - FullyQualifiedName = "TUnit.TestProject.CustomDisplayNameTests.NestedClassConstantTest", - FilePath = @"", - LineNumber = 86, - 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.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(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)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_CustomDisplayNameTests__ClassHelper -{ internal static global::TUnit.TestProject.CustomDisplayNameTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.CustomDisplayNameTests(); @@ -1100,14 +1487,6 @@ internal static class TUnit_TestProject_CustomDisplayNameTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.CustomDisplayNameTests), new TUnit_TestProject_CustomDisplayNameTests_DifferentClassConstantTest_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.CustomDisplayNameTests), new TUnit_TestProject_CustomDisplayNameTests_MethodDataSourceTest__string_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.CustomDisplayNameTests), new TUnit_TestProject_CustomDisplayNameTests_NestedClassConstantTest_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.CustomDisplayNameTests), new TUnit_TestProject_CustomDisplayNameTests_PasswordTest__string_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.CustomDisplayNameTests), new TUnit_TestProject_CustomDisplayNameTests_SameClassConstantTest_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.CustomDisplayNameTests), new TUnit_TestProject_CustomDisplayNameTests_Test2_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.CustomDisplayNameTests), new TUnit_TestProject_CustomDisplayNameTests_Test3__string_int_bool_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.CustomDisplayNameTests), new TUnit_TestProject_CustomDisplayNameTests_TestParameterNamePrefixBug__int_string_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.CustomDisplayNameTests), new TUnit_TestProject_CustomDisplayNameTests_Test_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.CustomDisplayNameTests), new TUnit_TestProject_CustomDisplayNameTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/DataDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/DataDrivenTests.Test.verified.txt index fefe151725c..ac8f1bfafa2 100644 --- a/TUnit.Core.SourceGenerator.Tests/DataDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DataDrivenTests.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_DataDrivenTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_DataSource_Method__int = new global::TUnit.Core.TestMetadata { TestName = "DataSource_Method", TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "DataSource_Method", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1), @@ -58,81 +58,17 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_T Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.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.DataDrivenTests.DataSource_Method", - ClassName = "DataDrivenTests", - MethodName = "DataSource_Method", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method", - FilePath = @"", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method__int, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_string_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_Method__int.UseRuntimeDataGeneration(testSessionId); + var metadata_DataSource_Method__int_string = new global::TUnit.Core.TestMetadata { TestName = "DataSource_Method", TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "DataSource_Method", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1, "String"), @@ -182,81 +118,17 @@ internal sealed class TUnit_TestProject_DataDrivenTests_DataSource_Method__int_s Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.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.DataDrivenTests.DataSource_Method", - ClassName = "DataDrivenTests", - MethodName = "DataSource_Method", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method", - FilePath = @"", - LineNumber = 17, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method__int_string, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 2: - { - instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_Method__int_string.UseRuntimeDataGeneration(testSessionId); + var metadata_EnumValue__TestEnum = new global::TUnit.Core.TestMetadata { TestName = "EnumValue", TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "EnumValue", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.TestEnum.One), @@ -299,81 +171,17 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_Test Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.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.DataDrivenTests.EnumValue", - ClassName = "DataDrivenTests", - MethodName = "EnumValue", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EnumValue", - FilePath = @"", - LineNumber = 26, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_EnumValue__TestEnum, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.EnumValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_NullValue__string__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_EnumValue__TestEnum.UseRuntimeDataGeneration(testSessionId); + var metadata_NullValue__string_ = new global::TUnit.Core.TestMetadata { TestName = "NullValue", TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "NullValue", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(null), @@ -414,81 +222,17 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NullValue__string__TestS Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.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.DataDrivenTests.NullValue", - ClassName = "DataDrivenTests", - MethodName = "NullValue", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NullValue", - FilePath = @"", - LineNumber = 35, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_NullValue__string_, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.NullValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_EmptyString__string__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_NullValue__string_.UseRuntimeDataGeneration(testSessionId); + var metadata_EmptyString__string_ = new global::TUnit.Core.TestMetadata { TestName = "EmptyString", TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "EmptyString", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(""), @@ -529,96 +273,832 @@ internal sealed class TUnit_TestProject_DataDrivenTests_EmptyString__string__Tes Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_EmptyString__string_, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor + metadata_EmptyString__string_.UseRuntimeDataGeneration(testSessionId); + var metadata_NonEmptyString__string_ = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.DataDrivenTests.EmptyString", - ClassName = "DataDrivenTests", - MethodName = "EmptyString", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EmptyString", - FilePath = @"", + TestName = "NonEmptyString", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "NonEmptyString", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute("Foo bar!"), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 49, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "NonEmptyString", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("NonEmptyString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_NonEmptyString__string_, + }; + metadata_NonEmptyString__string_.UseRuntimeDataGeneration(testSessionId); + var metadata_BooleanString__bool_ = new global::TUnit.Core.TestMetadata + { + TestName = "BooleanString", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "BooleanString", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 56, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "BooleanString", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(bool?)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool?)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("BooleanString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool?) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_BooleanString__bool_, + }; + metadata_BooleanString__bool_.UseRuntimeDataGeneration(testSessionId); + var metadata_Type__Type = new global::TUnit.Core.TestMetadata + { + TestName = "Type", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "Type", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(typeof(object)), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 65, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "Type", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::System.Type)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Type)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("Type", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Type) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Type__Type, + }; + metadata_Type__Type.UseRuntimeDataGeneration(testSessionId); + var metadata_IntegerArray__int__ = new global::TUnit.Core.TestMetadata + { + TestName = "IntegerArray", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "IntegerArray", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(new[] { 1, 2, 3 }), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 72, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "IntegerArray", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int[])) + { + Name = "values", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int[])), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("IntegerArray", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int[]) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_IntegerArray__int__, + }; + metadata_IntegerArray__int__.UseRuntimeDataGeneration(testSessionId); + var metadata_IntMaxValue__int = new global::TUnit.Core.TestMetadata + { + TestName = "IntMaxValue", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "IntMaxValue", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(2147483647), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 79, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "IntMaxValue", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("IntMaxValue", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_IntMaxValue__int, + }; + metadata_IntMaxValue__int.UseRuntimeDataGeneration(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 }; + } + public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + { + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.DataSource_Method", + ClassName = "DataDrivenTests", + MethodName = "DataSource_Method", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method", + FilePath = @"", + LineNumber = 8, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_DataSource_Method__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.DataSource_Method", + ClassName = "DataDrivenTests", + MethodName = "DataSource_Method", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.DataSource_Method", + FilePath = @"", + LineNumber = 17, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_DataSource_Method__int_string + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.EnumValue", + ClassName = "DataDrivenTests", + MethodName = "EnumValue", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EnumValue", + FilePath = @"", + LineNumber = 26, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_EnumValue__TestEnum + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.NullValue", + ClassName = "DataDrivenTests", + MethodName = "NullValue", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NullValue", + FilePath = @"", + LineNumber = 35, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_NullValue__string_ + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.EmptyString", + ClassName = "DataDrivenTests", + MethodName = "EmptyString", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.EmptyString", + FilePath = @"", LineNumber = 42, Categories = global::System.Array.Empty(), Properties = global::System.Array.Empty(), HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_EmptyString__string_ + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.NonEmptyString", + ClassName = "DataDrivenTests", + MethodName = "NonEmptyString", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NonEmptyString", + FilePath = @"", + LineNumber = 49, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_NonEmptyString__string_ + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.BooleanString", + ClassName = "DataDrivenTests", + MethodName = "BooleanString", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.BooleanString", + FilePath = @"", + LineNumber = 56, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_BooleanString__bool_ + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.Type", + ClassName = "DataDrivenTests", + MethodName = "Type", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.Type", + FilePath = @"", + LineNumber = 65, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Type__Type + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.IntegerArray", + ClassName = "DataDrivenTests", + MethodName = "IntegerArray", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntegerArray", + FilePath = @"", + LineNumber = 72, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_IntegerArray__int__ + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataDrivenTests.IntMaxValue", + ClassName = "DataDrivenTests", + MethodName = "IntMaxValue", + FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntMaxValue", + FilePath = @"", + LineNumber = 79, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + 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 metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_Method", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "DataSource_Method", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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), + }, + 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 + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataSource_Method", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method__int, }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method__int_string(string testSessionId) { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_Method", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "DataSource_Method", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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"), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 17, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "DataSource_Method", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.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] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "value2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("DataSource_Method", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method__int_string, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_EnumValue__TestEnum(string testSessionId) { - try + var metadata = new global::TUnit.Core.TestMetadata { - switch (args.Length) + TestName = "EnumValue", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "EnumValue", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] { - case 1: + 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), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 26, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "EnumValue", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.TestEnum)) { - instance.EmptyString(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); + Name = "testEnum", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TestEnum)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("EnumValue", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.TestEnum) }, null)!.GetParameters()[0] } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } + }, + Class = 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_EnumValue__TestEnum, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_NullValue__string_(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { - TestName = "NonEmptyString", + TestName = "NullValue", TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), - TestMethodName = "NonEmptyString", + TestMethodName = "NullValue", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { - new global::TUnit.Core.ArgumentsAttribute("Foo bar!"), + new global::TUnit.Core.ArgumentsAttribute(null), }, ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 49, + LineNumber = 35, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.DataDrivenTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), - Name = "NonEmptyString", + Name = "NullValue", GenericTypeCount = 0, ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), @@ -629,7 +1109,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ Name = "value", TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), IsNullable = true, - ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("NonEmptyString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("NullValue", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", new global::TUnit.Core.ClassMetadata @@ -644,73 +1124,123 @@ internal sealed class TUnit_TestProject_DataDrivenTests_NonEmptyString__string__ Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_NullValue__string_, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_EmptyString__string_(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.DataDrivenTests.NonEmptyString", - ClassName = "DataDrivenTests", - MethodName = "NonEmptyString", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.NonEmptyString", + TestName = "EmptyString", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "EmptyString", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(""), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", - LineNumber = 49, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + LineNumber = 42, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "EmptyString", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("EmptyString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_EmptyString__string_, }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_NonEmptyString__string_(string testSessionId) { - try + var metadata = new global::TUnit.Core.TestMetadata { - switch (args.Length) + TestName = "NonEmptyString", + TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), + TestMethodName = "NonEmptyString", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] { - case 1: + new global::TUnit.Core.ArgumentsAttribute("Foo bar!"), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 49, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataDrivenTests)), + Name = "NonEmptyString", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) { - 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)); - } + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.DataDrivenTests).GetMethod("NonEmptyString", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_NonEmptyString__string_, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_BooleanString__bool_(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -718,7 +1248,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__Tes TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "BooleanString", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(null), @@ -761,73 +1291,13 @@ internal sealed class TUnit_TestProject_DataDrivenTests_BooleanString__bool__Tes Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_BooleanString__bool_, }; 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.DataDrivenTests.BooleanString", - ClassName = "DataDrivenTests", - MethodName = "BooleanString", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.BooleanString", - FilePath = @"", - LineNumber = 56, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.BooleanString(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Type__Type(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -835,7 +1305,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "Type", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(typeof(object)), @@ -876,73 +1346,13 @@ internal sealed class TUnit_TestProject_DataDrivenTests_Type__Type_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Type__Type, }; 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.DataDrivenTests.Type", - ClassName = "DataDrivenTests", - MethodName = "Type", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.Type", - FilePath = @"", - LineNumber = 65, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.Type(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_IntegerArray__int__(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -950,7 +1360,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___Test TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "IntegerArray", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(new[] { 1, 2, 3 }), @@ -991,73 +1401,13 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntegerArray__int___Test Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_IntegerArray__int__, }; 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.DataDrivenTests.IntegerArray", - ClassName = "DataDrivenTests", - MethodName = "IntegerArray", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntegerArray", - FilePath = @"", - LineNumber = 72, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.IntegerArray(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_IntMaxValue__int(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -1065,7 +1415,7 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSou TestClassType = typeof(global::TUnit.TestProject.DataDrivenTests), TestMethodName = "IntMaxValue", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(2147483647), @@ -1106,72 +1456,12 @@ internal sealed class TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSou Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_IntMaxValue__int, }; 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.DataDrivenTests.IntMaxValue", - ClassName = "DataDrivenTests", - MethodName = "IntMaxValue", - FullyQualifiedName = "TUnit.TestProject.DataDrivenTests.IntMaxValue", - FilePath = @"", - LineNumber = 79, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.IntMaxValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_DataDrivenTests__ClassHelper -{ internal static global::TUnit.TestProject.DataDrivenTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.DataDrivenTests(); @@ -1179,15 +1469,6 @@ internal static class TUnit_TestProject_DataDrivenTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_BooleanString__bool__TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_DataSource_Method__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_DataSource_Method__int_string_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_EmptyString__string__TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_EnumValue__TestEnum_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_IntMaxValue__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_IntegerArray__int___TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_NonEmptyString__string__TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_NullValue__string__TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests_Type__Type_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataDrivenTests), new TUnit_TestProject_DataDrivenTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/DataSourceClassCombinedWithDataSourceMethodTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/DataSourceClassCombinedWithDataSourceMethodTests.Test.verified.txt index 8ebbf56657e..a7dd00e34ea 100644 --- a/TUnit.Core.SourceGenerator.Tests/DataSourceClassCombinedWithDataSourceMethodTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DataSourceClassCombinedWithDataSourceMethodTests.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataSourceClassCombinedWithDataSourceMethod_DataSourceClassCombinedW_3C180E22_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_DataSourceClassCombinedWithDataSourceMethod__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_DataSourceClassCombinedWithDataSourceMethodTest__int = new global::TUnit.Core.TestMetadata { TestName = "DataSourceClassCombinedWithDataSourceMethodTest", TestClassType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), TestMethodName = "DataSourceClassCombinedWithDataSourceMethodTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "One") @@ -138,11 +138,11 @@ internal sealed class TUnit_TestProject_DataSourceClassCombinedWithDataSourceMet Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataSourceClassCombinedWithDataSourceMethod__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSourceClassCombinedWithDataSourceMethodTest__int, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_DataSourceClassCombinedWithDataSourceMethodTest__int.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_DataSourceClassCombinedWithDataSourceMethodTest__int }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -159,10 +159,10 @@ internal sealed class TUnit_TestProject_DataSourceClassCombinedWithDataSourceMet HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_DataSourceClassCombinedWithDataSourceMethodTest__int }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -173,7 +173,7 @@ internal sealed class TUnit_TestProject_DataSourceClassCombinedWithDataSourceMet new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.CommonTestData), "Three") ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSourceClassCombinedWithDataSourceMethodTest__int(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -193,20 +193,143 @@ internal sealed class TUnit_TestProject_DataSourceClassCombinedWithDataSourceMet return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_DataSourceClassCombinedWithDataSourceMethod__ClassHelper -{ + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSourceClassCombinedWithDataSourceMethodTest__int(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSourceClassCombinedWithDataSourceMethodTest", + TestClassType = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), + TestMethodName = "DataSourceClassCombinedWithDataSourceMethodTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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(); + } + }, + }, + ClassDataSources = 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(); + } + }, + }, + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 13, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod)), + Name = "DataSourceClassCombinedWithDataSourceMethodTest", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "i", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetMethod("DataSourceClassCombinedWithDataSourceMethodTest", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod", 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "i", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSourceClassCombinedWithDataSourceMethodTest__int, + }; + metadata.UseRuntimeDataGeneration(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])); @@ -214,6 +337,6 @@ internal static class TUnit_TestProject_DataSourceClassCombinedWithDataSourceMet [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), new TUnit_TestProject_DataSourceClassCombinedWithDataSourceMethod_DataSourceClassCombinedW_3C180E22_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataSourceClassCombinedWithDataSourceMethod), new TUnit_TestProject_DataSourceClassCombinedWithDataSourceMethod__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Typed.verified.txt b/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Typed.verified.txt index c39a30e5995..3efc46cb0b0 100644 --- a/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Typed.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Typed.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataSourceGeneratorTests_GeneratedData_Method__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_DataSourceGeneratorTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_GeneratedData_Method__int = new global::TUnit.Core.TestMetadata { TestName = "GeneratedData_Method", TestClassType = typeof(global::TUnit.TestProject.DataSourceGeneratorTests), TestMethodName = "GeneratedData_Method", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), @@ -83,11 +83,195 @@ internal sealed class TUnit_TestProject_DataSourceGeneratorTests_GeneratedData_M Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataSourceGeneratorTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_GeneratedData_Method__int, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_GeneratedData_Method__int.UseRuntimeDataGeneration(testSessionId); + var metadata_GeneratedData_Method2__int_string_bool = new global::TUnit.Core.TestMetadata + { + TestName = "GeneratedData_Method2", + TestClassType = typeof(global::TUnit.TestProject.DataSourceGeneratorTests), + TestMethodName = "GeneratedData_Method2", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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(), + }, + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 18, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataSourceGeneratorTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataSourceGeneratorTests)), + Name = "GeneratedData_Method2", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).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] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "value2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).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] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "value3", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetMethod("GeneratedData_Method2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string), typeof(bool) }, null)!.GetParameters()[2] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataSourceGeneratorTests", 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "value2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[1] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "value3", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[2] + } + }, + Properties = global::System.Array.Empty(), + Parent = null + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_GeneratedData_Method2__int_string_bool, + }; + metadata_GeneratedData_Method2__int_string_bool.UseRuntimeDataGeneration(testSessionId); + var metadata_GeneratedData_Method3__int_string_bool = new global::TUnit.Core.TestMetadata + { + TestName = "GeneratedData_Method3", + TestClassType = typeof(global::TUnit.TestProject.DataSourceGeneratorTests), + TestMethodName = "GeneratedData_Method3", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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(), + }, + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 24, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataSourceGeneratorTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataSourceGeneratorTests)), + Name = "GeneratedData_Method3", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).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] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "value2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).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] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "value3", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetMethod("GeneratedData_Method3", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string), typeof(bool) }, null)!.GetParameters()[2] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataSourceGeneratorTests", 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "value2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[1] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "value3", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[2] + } + }, + Properties = global::System.Array.Empty(), + Parent = null + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_GeneratedData_Method3__int_string_bool, + }; + metadata_GeneratedData_Method3__int_string_bool.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_GeneratedData_Method__int, metadata_GeneratedData_Method2__int_string_bool, metadata_GeneratedData_Method3__int_string_bool }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -104,10 +288,40 @@ internal sealed class TUnit_TestProject_DataSourceGeneratorTests_GeneratedData_M HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_GeneratedData_Method__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataSourceGeneratorTests.GeneratedData_Method2", + ClassName = "DataSourceGeneratorTests", + MethodName = "GeneratedData_Method2", + FullyQualifiedName = "TUnit.TestProject.DataSourceGeneratorTests.GeneratedData_Method2", + FilePath = @"", + LineNumber = 18, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_GeneratedData_Method2__int_string_bool + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DataSourceGeneratorTests.GeneratedData_Method3", + ClassName = "DataSourceGeneratorTests", + MethodName = "GeneratedData_Method3", + FullyQualifiedName = "TUnit.TestProject.DataSourceGeneratorTests.GeneratedData_Method3", + FilePath = @"", + LineNumber = 24, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_GeneratedData_Method3__int_string_bool }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -117,7 +331,7 @@ internal sealed class TUnit_TestProject_DataSourceGeneratorTests_GeneratedData_M new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute() ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataSourceGeneratorTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_GeneratedData_Method__int(global::TUnit.TestProject.DataSourceGeneratorTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -137,21 +351,129 @@ internal sealed class TUnit_TestProject_DataSourceGeneratorTests_GeneratedData_M return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataSourceGeneratorTests_GeneratedData_Method2__int_string_bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata + { + TestName = "GeneratedData_Method", + TestClassType = typeof(global::TUnit.TestProject.DataSourceGeneratorTests), + TestMethodName = "GeneratedData_Method", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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(), + }, + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 12, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DataSourceGeneratorTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DataSourceGeneratorTests)), + Name = "GeneratedData_Method", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetMethod("GeneratedData_Method", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DataSourceGeneratorTests", 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "value2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[1] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "value3", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DataSourceGeneratorTests).GetConstructor(new global::System.Type[] { typeof(int), typeof(string), typeof(bool) })!.GetParameters()[2] + } + }, + Properties = global::System.Array.Empty(), + Parent = null + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_GeneratedData_Method__int, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_GeneratedData_Method2__int_string_bool(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -159,7 +481,7 @@ internal sealed class TUnit_TestProject_DataSourceGeneratorTests_GeneratedData_M TestClassType = typeof(global::TUnit.TestProject.DataSourceGeneratorTests), TestMethodName = "GeneratedData_Method2", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), @@ -241,75 +563,13 @@ internal sealed class TUnit_TestProject_DataSourceGeneratorTests_GeneratedData_M Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataSourceGeneratorTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_GeneratedData_Method2__int_string_bool, }; 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.DataSourceGeneratorTests.GeneratedData_Method2", - ClassName = "DataSourceGeneratorTests", - MethodName = "GeneratedData_Method2", - FullyQualifiedName = "TUnit.TestProject.DataSourceGeneratorTests.GeneratedData_Method2", - FilePath = @"", - LineNumber = 18, - 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.TestProject.Attributes.AutoFixtureGeneratorAttribute(), - new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataSourceGeneratorTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 3: - { - instance.GeneratedData_Method2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DataSourceGeneratorTests_GeneratedData_Method3__int_string_bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_GeneratedData_Method3__int_string_bool(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -317,7 +577,7 @@ internal sealed class TUnit_TestProject_DataSourceGeneratorTests_GeneratedData_M TestClassType = typeof(global::TUnit.TestProject.DataSourceGeneratorTests), TestMethodName = "GeneratedData_Method3", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute(), @@ -399,74 +659,12 @@ internal sealed class TUnit_TestProject_DataSourceGeneratorTests_GeneratedData_M Parent = null }) }, - InstanceFactory = TUnit_TestProject_DataSourceGeneratorTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_GeneratedData_Method3__int_string_bool, }; 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.DataSourceGeneratorTests.GeneratedData_Method3", - ClassName = "DataSourceGeneratorTests", - MethodName = "GeneratedData_Method3", - FullyQualifiedName = "TUnit.TestProject.DataSourceGeneratorTests.GeneratedData_Method3", - FilePath = @"", - LineNumber = 24, - 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.TestProject.Attributes.AutoFixtureGeneratorAttribute(), - new global::TUnit.TestProject.Attributes.AutoFixtureGeneratorAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DataSourceGeneratorTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 3: - { - instance.GeneratedData_Method3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_DataSourceGeneratorTests__ClassHelper -{ 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])); @@ -474,8 +672,6 @@ internal static class TUnit_TestProject_DataSourceGeneratorTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataSourceGeneratorTests), new TUnit_TestProject_DataSourceGeneratorTests_GeneratedData_Method2__int_string_bool_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataSourceGeneratorTests), new TUnit_TestProject_DataSourceGeneratorTests_GeneratedData_Method3__int_string_bool_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataSourceGeneratorTests), new TUnit_TestProject_DataSourceGeneratorTests_GeneratedData_Method__int_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DataSourceGeneratorTests), new TUnit_TestProject_DataSourceGeneratorTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Untyped.verified.txt b/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Untyped.verified.txt index 1a48cca7c54..f7f5bcbe985 100644 --- a/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Untyped.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DataSourceGeneratorTests.Untyped.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_AutoDataTests_Test1__string_int_double_bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_AutoDataTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_Test1__string_int_double_bool = new global::TUnit.Core.TestMetadata { TestName = "Test1", TestClassType = typeof(global::TUnit.TestProject.AutoDataTests), TestMethodName = "Test1", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.TestProject.Attributes.AutoDataAttribute(), @@ -77,11 +77,11 @@ internal sealed class TUnit_TestProject_AutoDataTests_Test1__string_int_double_b Parent = null }) }, - InstanceFactory = TUnit_TestProject_AutoDataTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test1__string_int_double_bool, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_Test1__string_int_double_bool.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_Test1__string_int_double_bool }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -98,17 +98,17 @@ internal sealed class TUnit_TestProject_AutoDataTests_Test1__string_int_double_b HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_Test1__string_int_double_bool }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ new global::TUnit.Core.TestAttribute() ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AutoDataTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + 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) { try { @@ -127,20 +127,82 @@ internal sealed class TUnit_TestProject_AutoDataTests_Test1__string_int_double_b return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_AutoDataTests__ClassHelper -{ + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test1__string_int_double_bool(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "Test1", + TestClassType = typeof(global::TUnit.TestProject.AutoDataTests), + TestMethodName = "Test1", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.TestProject.Attributes.AutoDataAttribute(), + }, + 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 + { + Type = typeof(global::TUnit.TestProject.AutoDataTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AutoDataTests)), + Name = "Test1", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "value1", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.AutoDataTests).GetMethod("Test1", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(int), typeof(double), typeof(bool) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.AutoDataTests).GetMethod("Test1", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(int), typeof(double), typeof(bool) }, null)!.GetParameters()[1] + }, + new global::TUnit.Core.ParameterMetadata(typeof(double)) + { + Name = "value3", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(double)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.AutoDataTests).GetMethod("Test1", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(int), typeof(double), typeof(bool) }, null)!.GetParameters()[2] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "value4", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.AutoDataTests).GetMethod("Test1", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(int), typeof(double), typeof(bool) }, null)!.GetParameters()[3] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.AutoDataTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test1__string_int_double_bool, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } internal static global::TUnit.TestProject.AutoDataTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.AutoDataTests(); @@ -148,6 +210,6 @@ internal static class TUnit_TestProject_AutoDataTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AutoDataTests), new TUnit_TestProject_AutoDataTests_Test1__string_int_double_bool_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AutoDataTests), new TUnit_TestProject_AutoDataTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/DecimalArgumentTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/DecimalArgumentTests.Test.verified.txt index 3d5f359ea78..3a9439ee810 100644 --- a/TUnit.Core.SourceGenerator.Tests/DecimalArgumentTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DecimalArgumentTests.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DecimalArgumentTests_Transfer__decimal_decimal_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_DecimalArgumentTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_Transfer__decimal_decimal = new global::TUnit.Core.TestMetadata { TestName = "Transfer", TestClassType = typeof(global::TUnit.TestProject.DecimalArgumentTests), TestMethodName = "Transfer", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(2_000m, 123_999.00000000000000001m), @@ -65,80 +65,17 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_Transfer__decimal_d Parent = null }) }, - InstanceFactory = TUnit_TestProject_DecimalArgumentTests__ClassHelper.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.DecimalArgumentTests.Transfer", - ClassName = "DecimalArgumentTests", - MethodName = "Transfer", - FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.Transfer", - FilePath = @"", - LineNumber = 9, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Transfer__decimal_decimal, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DecimalArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.Transfer(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DecimalArgumentTests_SimpleDecimal__decimal_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_Transfer__decimal_decimal.UseRuntimeDataGeneration(testSessionId); + var metadata_SimpleDecimal__decimal = new global::TUnit.Core.TestMetadata { TestName = "SimpleDecimal", TestClassType = typeof(global::TUnit.TestProject.DecimalArgumentTests), TestMethodName = "SimpleDecimal", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(123.456m), @@ -179,80 +116,17 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_SimpleDecimal__deci Parent = null }) }, - InstanceFactory = TUnit_TestProject_DecimalArgumentTests__ClassHelper.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.DecimalArgumentTests.SimpleDecimal", - ClassName = "DecimalArgumentTests", - MethodName = "SimpleDecimal", - FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.SimpleDecimal", - FilePath = @"", - LineNumber = 29, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SimpleDecimal__decimal, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DecimalArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.SimpleDecimal(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DecimalArgumentTests_SmallDecimal__decimal_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_SimpleDecimal__decimal.UseRuntimeDataGeneration(testSessionId); + var metadata_SmallDecimal__decimal = new global::TUnit.Core.TestMetadata { TestName = "SmallDecimal", TestClassType = typeof(global::TUnit.TestProject.DecimalArgumentTests), TestMethodName = "SmallDecimal", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(0.00000000000000001m), @@ -293,80 +167,17 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_SmallDecimal__decim Parent = null }) }, - InstanceFactory = TUnit_TestProject_DecimalArgumentTests__ClassHelper.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.DecimalArgumentTests.SmallDecimal", - ClassName = "DecimalArgumentTests", - MethodName = "SmallDecimal", - FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.SmallDecimal", - FilePath = @"", - LineNumber = 36, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SmallDecimal__decimal, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DecimalArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.SmallDecimal(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DecimalArgumentTests_MaxDecimal__decimal_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_SmallDecimal__decimal.UseRuntimeDataGeneration(testSessionId); + var metadata_MaxDecimal__decimal = new global::TUnit.Core.TestMetadata { TestName = "MaxDecimal", TestClassType = typeof(global::TUnit.TestProject.DecimalArgumentTests), TestMethodName = "MaxDecimal", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("79228162514264337593543950335"), @@ -407,80 +218,17 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_MaxDecimal__decimal Parent = null }) }, - InstanceFactory = TUnit_TestProject_DecimalArgumentTests__ClassHelper.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.DecimalArgumentTests.MaxDecimal", - ClassName = "DecimalArgumentTests", - MethodName = "MaxDecimal", - FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.MaxDecimal", - FilePath = @"", - LineNumber = 43, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MaxDecimal__decimal, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DecimalArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.MaxDecimal(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DecimalArgumentTests_MinDecimal__decimal_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_MaxDecimal__decimal.UseRuntimeDataGeneration(testSessionId); + var metadata_MinDecimal__decimal = new global::TUnit.Core.TestMetadata { TestName = "MinDecimal", TestClassType = typeof(global::TUnit.TestProject.DecimalArgumentTests), TestMethodName = "MinDecimal", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("-79228162514264337593543950335"), @@ -521,80 +269,17 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_MinDecimal__decimal Parent = null }) }, - InstanceFactory = TUnit_TestProject_DecimalArgumentTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MinDecimal__decimal, }; - 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.DecimalArgumentTests.MinDecimal", - ClassName = "DecimalArgumentTests", - MethodName = "MinDecimal", - FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.MinDecimal", - FilePath = @"", - LineNumber = 50, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DecimalArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.MinDecimal(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DecimalArgumentTests_ExplicitDecimalValue__decimal_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_MinDecimal__decimal.UseRuntimeDataGeneration(testSessionId); + var metadata_ExplicitDecimalValue__decimal = new global::TUnit.Core.TestMetadata { TestName = "ExplicitDecimalValue", TestClassType = typeof(global::TUnit.TestProject.DecimalArgumentTests), TestMethodName = "ExplicitDecimalValue", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("123.456"), @@ -635,80 +320,17 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_ExplicitDecimalValu Parent = null }) }, - InstanceFactory = TUnit_TestProject_DecimalArgumentTests__ClassHelper.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.DecimalArgumentTests.ExplicitDecimalValue", - ClassName = "DecimalArgumentTests", - MethodName = "ExplicitDecimalValue", - FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.ExplicitDecimalValue", - FilePath = @"", - LineNumber = 57, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ExplicitDecimalValue__decimal, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DecimalArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.ExplicitDecimalValue(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DecimalArgumentTests_MultipleDecimals__decimal_decimal_decimal_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_ExplicitDecimalValue__decimal.UseRuntimeDataGeneration(testSessionId); + var metadata_MultipleDecimals__decimal_decimal_decimal = new global::TUnit.Core.TestMetadata { TestName = "MultipleDecimals", TestClassType = typeof(global::TUnit.TestProject.DecimalArgumentTests), TestMethodName = "MultipleDecimals", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1.1m, 2.2m, 3.3m), @@ -763,80 +385,17 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_MultipleDecimals__d Parent = null }) }, - InstanceFactory = TUnit_TestProject_DecimalArgumentTests__ClassHelper.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.DecimalArgumentTests.MultipleDecimals", - ClassName = "DecimalArgumentTests", - MethodName = "MultipleDecimals", - FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.MultipleDecimals", - FilePath = @"", - LineNumber = 64, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MultipleDecimals__decimal_decimal_decimal, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DecimalArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 3: - { - return new global::System.Threading.Tasks.ValueTask(instance.MultipleDecimals(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DecimalArgumentTests_Test__decimal_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_MultipleDecimals__decimal_decimal_decimal.UseRuntimeDataGeneration(testSessionId); + var metadata_Test__decimal = new global::TUnit.Core.TestMetadata { TestName = "Test", TestClassType = typeof(global::TUnit.TestProject.DecimalArgumentTests), TestMethodName = "Test", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(0.5m), @@ -879,73 +438,1140 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_Test__decimal_TestS Parent = null }) }, - InstanceFactory = TUnit_TestProject_DecimalArgumentTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test__decimal, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor + metadata_Test__decimal.UseRuntimeDataGeneration(testSessionId); + var metadata_TransactionDiscountCalculations__decimal_decimal_decimal_decimal_decimal_bool = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.DecimalArgumentTests.Test", - ClassName = "DecimalArgumentTests", - MethodName = "Test", - FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.Test", + TestName = "TransactionDiscountCalculations", + TestClassType = typeof(global::TUnit.TestProject.DecimalArgumentTests), + TestMethodName = "TransactionDiscountCalculations", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", - LineNumber = 73, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DecimalArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) + LineNumber = 82, + MethodMetadata = new global::TUnit.Core.MethodMetadata { - case 1: + Type = typeof(global::TUnit.TestProject.DecimalArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DecimalArgumentTests)), + Name = "TransactionDiscountCalculations", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(decimal)) { - 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)); - } + Name = "amountPaying", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(decimal)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DecimalArgumentTests).GetMethod("TransactionDiscountCalculations", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(decimal), typeof(decimal), typeof(decimal), typeof(decimal), typeof(decimal), typeof(bool) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(decimal)) + { + Name = "invoiceBalance", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(decimal)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DecimalArgumentTests).GetMethod("TransactionDiscountCalculations", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(decimal), typeof(decimal), typeof(decimal), typeof(decimal), typeof(decimal), typeof(bool) }, null)!.GetParameters()[1] + }, + new global::TUnit.Core.ParameterMetadata(typeof(decimal)) + { + Name = "invoiceBalanceDue", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(decimal)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DecimalArgumentTests).GetMethod("TransactionDiscountCalculations", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(decimal), typeof(decimal), typeof(decimal), typeof(decimal), typeof(decimal), typeof(bool) }, null)!.GetParameters()[2] + }, + new global::TUnit.Core.ParameterMetadata(typeof(decimal)) + { + Name = "discountAmount", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(decimal)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DecimalArgumentTests).GetMethod("TransactionDiscountCalculations", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(decimal), typeof(decimal), typeof(decimal), typeof(decimal), typeof(decimal), typeof(bool) }, null)!.GetParameters()[3] + }, + new global::TUnit.Core.ParameterMetadata(typeof(decimal)) + { + Name = "appliedDiscountAmount", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(decimal)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DecimalArgumentTests).GetMethod("TransactionDiscountCalculations", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(decimal), typeof(decimal), typeof(decimal), typeof(decimal), typeof(decimal), typeof(bool) }, null)!.GetParameters()[4] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "discountAllowedForUser", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DecimalArgumentTests).GetMethod("TransactionDiscountCalculations", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(decimal), typeof(decimal), typeof(decimal), typeof(decimal), typeof(decimal), typeof(bool) }, null)!.GetParameters()[5] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_TransactionDiscountCalculations__decimal_decimal_decimal_decimal_decimal_bool, + }; + metadata_TransactionDiscountCalculations__decimal_decimal_decimal_decimal_decimal_bool.UseRuntimeDataGeneration(testSessionId); + var metadata_Equality3__decimal = new global::TUnit.Core.TestMetadata + { + TestName = "Equality3", + TestClassType = typeof(global::TUnit.TestProject.DecimalArgumentTests), + TestMethodName = "Equality3", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(2_000.00000000000000001m), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 91, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DecimalArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DecimalArgumentTests)), + Name = "Equality3", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(decimal)) + { + Name = "credit", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(decimal)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DecimalArgumentTests).GetMethod("Equality3", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(decimal) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Equality3__decimal, + }; + metadata_Equality3__decimal.UseRuntimeDataGeneration(testSessionId); + var metadata_Equality4__decimal = new global::TUnit.Core.TestMetadata + { + TestName = "Equality4", + TestClassType = typeof(global::TUnit.TestProject.DecimalArgumentTests), + TestMethodName = "Equality4", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(123_999.00000000000000001m), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 104, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DecimalArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DecimalArgumentTests)), + Name = "Equality4", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(decimal)) + { + Name = "credit", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(decimal)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DecimalArgumentTests).GetMethod("Equality4", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(decimal) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Equality4__decimal, + }; + metadata_Equality4__decimal.UseRuntimeDataGeneration(testSessionId); + var metadata_TestMethod__decimal = new global::TUnit.Core.TestMetadata + { + TestName = "TestMethod", + TestClassType = typeof(global::TUnit.TestProject.DecimalArgumentTests), + TestMethodName = "TestMethod", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(42), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 119, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DecimalArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DecimalArgumentTests)), + Name = "TestMethod", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(decimal)) + { + Name = "batchingSize", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(decimal)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DecimalArgumentTests).GetMethod("TestMethod", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(decimal) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_TestMethod__decimal, + }; + metadata_TestMethod__decimal.UseRuntimeDataGeneration(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 }; + } + public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + { + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DecimalArgumentTests.Transfer", + ClassName = "DecimalArgumentTests", + MethodName = "Transfer", + FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.Transfer", + FilePath = @"", + LineNumber = 9, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Transfer__decimal_decimal + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DecimalArgumentTests.SimpleDecimal", + ClassName = "DecimalArgumentTests", + MethodName = "SimpleDecimal", + FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.SimpleDecimal", + FilePath = @"", + LineNumber = 29, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_SimpleDecimal__decimal + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DecimalArgumentTests.SmallDecimal", + ClassName = "DecimalArgumentTests", + MethodName = "SmallDecimal", + FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.SmallDecimal", + FilePath = @"", + LineNumber = 36, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_SmallDecimal__decimal + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DecimalArgumentTests.MaxDecimal", + ClassName = "DecimalArgumentTests", + MethodName = "MaxDecimal", + FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.MaxDecimal", + FilePath = @"", + LineNumber = 43, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_MaxDecimal__decimal + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DecimalArgumentTests.MinDecimal", + ClassName = "DecimalArgumentTests", + MethodName = "MinDecimal", + FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.MinDecimal", + FilePath = @"", + LineNumber = 50, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_MinDecimal__decimal + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DecimalArgumentTests.ExplicitDecimalValue", + ClassName = "DecimalArgumentTests", + MethodName = "ExplicitDecimalValue", + FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.ExplicitDecimalValue", + FilePath = @"", + LineNumber = 57, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_ExplicitDecimalValue__decimal + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DecimalArgumentTests.MultipleDecimals", + ClassName = "DecimalArgumentTests", + MethodName = "MultipleDecimals", + FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.MultipleDecimals", + FilePath = @"", + LineNumber = 64, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_MultipleDecimals__decimal_decimal_decimal + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DecimalArgumentTests.Test", + ClassName = "DecimalArgumentTests", + MethodName = "Test", + FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.Test", + FilePath = @"", + LineNumber = 73, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Test__decimal + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DecimalArgumentTests.TransactionDiscountCalculations", + ClassName = "DecimalArgumentTests", + MethodName = "TransactionDiscountCalculations", + FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.TransactionDiscountCalculations", + FilePath = @"", + LineNumber = 82, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + 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 + { + TestId = "TUnit.TestProject.DecimalArgumentTests.Equality3", + ClassName = "DecimalArgumentTests", + MethodName = "Equality3", + FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.Equality3", + FilePath = @"", + LineNumber = 91, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Equality3__decimal + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DecimalArgumentTests.Equality4", + ClassName = "DecimalArgumentTests", + MethodName = "Equality4", + FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.Equality4", + FilePath = @"", + LineNumber = 104, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Equality4__decimal + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.DecimalArgumentTests.TestMethod", + ClassName = "DecimalArgumentTests", + MethodName = "TestMethod", + FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.TestMethod", + FilePath = @"", + LineNumber = 119, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + 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 metadata = new global::TUnit.Core.TestMetadata + { + TestName = "Transfer", + TestClassType = typeof(global::TUnit.TestProject.DecimalArgumentTests), + TestMethodName = "Transfer", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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), + }, + 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.DecimalArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DecimalArgumentTests)), + Name = "Transfer", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(decimal)) + { + Name = "debit", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(decimal)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DecimalArgumentTests).GetMethod("Transfer", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(decimal), typeof(decimal) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(decimal)) + { + Name = "credit", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(decimal)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DecimalArgumentTests).GetMethod("Transfer", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(decimal), typeof(decimal) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Transfer__decimal_decimal, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_SimpleDecimal__decimal(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "SimpleDecimal", + TestClassType = typeof(global::TUnit.TestProject.DecimalArgumentTests), + TestMethodName = "SimpleDecimal", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(123.456m), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 29, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DecimalArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DecimalArgumentTests)), + Name = "SimpleDecimal", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(decimal)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(decimal)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DecimalArgumentTests).GetMethod("SimpleDecimal", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(decimal) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SimpleDecimal__decimal, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_SmallDecimal__decimal(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "SmallDecimal", + TestClassType = typeof(global::TUnit.TestProject.DecimalArgumentTests), + TestMethodName = "SmallDecimal", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(0.00000000000000001m), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 36, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DecimalArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DecimalArgumentTests)), + Name = "SmallDecimal", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(decimal)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(decimal)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DecimalArgumentTests).GetMethod("SmallDecimal", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(decimal) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SmallDecimal__decimal, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_MaxDecimal__decimal(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "MaxDecimal", + TestClassType = typeof(global::TUnit.TestProject.DecimalArgumentTests), + TestMethodName = "MaxDecimal", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute("79228162514264337593543950335"), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 43, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DecimalArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DecimalArgumentTests)), + Name = "MaxDecimal", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(decimal)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(decimal)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DecimalArgumentTests).GetMethod("MaxDecimal", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(decimal) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MaxDecimal__decimal, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_MinDecimal__decimal(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "MinDecimal", + TestClassType = typeof(global::TUnit.TestProject.DecimalArgumentTests), + TestMethodName = "MinDecimal", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute("-79228162514264337593543950335"), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 50, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DecimalArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DecimalArgumentTests)), + Name = "MinDecimal", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(decimal)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(decimal)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DecimalArgumentTests).GetMethod("MinDecimal", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(decimal) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MinDecimal__decimal, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_ExplicitDecimalValue__decimal(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "ExplicitDecimalValue", + TestClassType = typeof(global::TUnit.TestProject.DecimalArgumentTests), + TestMethodName = "ExplicitDecimalValue", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute("123.456"), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 57, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DecimalArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DecimalArgumentTests)), + Name = "ExplicitDecimalValue", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(decimal)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(decimal)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DecimalArgumentTests).GetMethod("ExplicitDecimalValue", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(decimal) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ExplicitDecimalValue__decimal, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_MultipleDecimals__decimal_decimal_decimal(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "MultipleDecimals", + TestClassType = typeof(global::TUnit.TestProject.DecimalArgumentTests), + TestMethodName = "MultipleDecimals", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(1.1m, 2.2m, 3.3m), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 64, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DecimalArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DecimalArgumentTests)), + Name = "MultipleDecimals", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(decimal)) + { + Name = "a", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(decimal)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DecimalArgumentTests).GetMethod("MultipleDecimals", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(decimal), typeof(decimal), typeof(decimal) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(decimal)) + { + Name = "b", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(decimal)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DecimalArgumentTests).GetMethod("MultipleDecimals", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(decimal), typeof(decimal), typeof(decimal) }, null)!.GetParameters()[1] + }, + new global::TUnit.Core.ParameterMetadata(typeof(decimal)) + { + Name = "c", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(decimal)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DecimalArgumentTests).GetMethod("MultipleDecimals", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(decimal), typeof(decimal), typeof(decimal) }, null)!.GetParameters()[2] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MultipleDecimals__decimal_decimal_decimal, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test__decimal(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "Test", + TestClassType = typeof(global::TUnit.TestProject.DecimalArgumentTests), + TestMethodName = "Test", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 73, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.DecimalArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.DecimalArgumentTests)), + Name = "Test", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(decimal)) + { + Name = "test", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(decimal)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.DecimalArgumentTests).GetMethod("Test", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(decimal) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.DecimalArgumentTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test__decimal, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DecimalArgumentTests_TransactionDiscountCalculations__decimal_decima_54FB9799_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_TransactionDiscountCalculations__decimal_decimal_decimal_decimal_decimal_bool(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -953,7 +1579,7 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_TransactionDiscount TestClassType = typeof(global::TUnit.TestProject.DecimalArgumentTests), TestMethodName = "TransactionDiscountCalculations", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(50m, 75m, 70m, 5m, 0m, true), @@ -1031,73 +1657,13 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_TransactionDiscount Parent = null }) }, - InstanceFactory = TUnit_TestProject_DecimalArgumentTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_TransactionDiscountCalculations__decimal_decimal_decimal_decimal_decimal_bool, }; 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.DecimalArgumentTests.TransactionDiscountCalculations", - ClassName = "DecimalArgumentTests", - MethodName = "TransactionDiscountCalculations", - FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.TransactionDiscountCalculations", - FilePath = @"", - LineNumber = 82, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DecimalArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 6: - { - instance.TransactionDiscountCalculations(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]), global::TUnit.Core.Helpers.CastHelper.Cast(args[4]), global::TUnit.Core.Helpers.CastHelper.Cast(args[5])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 6 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DecimalArgumentTests_Equality3__decimal_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Equality3__decimal(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -1105,7 +1671,7 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_Equality3__decimal_ TestClassType = typeof(global::TUnit.TestProject.DecimalArgumentTests), TestMethodName = "Equality3", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(2_000.00000000000000001m), @@ -1146,72 +1712,13 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_Equality3__decimal_ Parent = null }) }, - InstanceFactory = TUnit_TestProject_DecimalArgumentTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Equality3__decimal, }; 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.DecimalArgumentTests.Equality3", - ClassName = "DecimalArgumentTests", - MethodName = "Equality3", - FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.Equality3", - FilePath = @"", - LineNumber = 91, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DecimalArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Equality3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DecimalArgumentTests_Equality4__decimal_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Equality4__decimal(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -1219,7 +1726,7 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_Equality4__decimal_ TestClassType = typeof(global::TUnit.TestProject.DecimalArgumentTests), TestMethodName = "Equality4", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(123_999.00000000000000001m), @@ -1260,72 +1767,13 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_Equality4__decimal_ Parent = null }) }, - InstanceFactory = TUnit_TestProject_DecimalArgumentTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Equality4__decimal, }; 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.DecimalArgumentTests.Equality4", - ClassName = "DecimalArgumentTests", - MethodName = "Equality4", - FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.Equality4", - FilePath = @"", - LineNumber = 104, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DecimalArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Equality4(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_DecimalArgumentTests_TestMethod__decimal_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_TestMethod__decimal(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -1333,7 +1781,7 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_TestMethod__decimal TestClassType = typeof(global::TUnit.TestProject.DecimalArgumentTests), TestMethodName = "TestMethod", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(42), @@ -1374,71 +1822,12 @@ internal sealed class TUnit_TestProject_DecimalArgumentTests_TestMethod__decimal Parent = null }) }, - InstanceFactory = TUnit_TestProject_DecimalArgumentTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_TestMethod__decimal, }; 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.DecimalArgumentTests.TestMethod", - ClassName = "DecimalArgumentTests", - MethodName = "TestMethod", - FullyQualifiedName = "TUnit.TestProject.DecimalArgumentTests.TestMethod", - FilePath = @"", - LineNumber = 119, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.DecimalArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.TestMethod(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_DecimalArgumentTests__ClassHelper -{ internal static global::TUnit.TestProject.DecimalArgumentTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.DecimalArgumentTests(); @@ -1446,17 +1835,6 @@ internal static class TUnit_TestProject_DecimalArgumentTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DecimalArgumentTests), new TUnit_TestProject_DecimalArgumentTests_Equality3__decimal_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DecimalArgumentTests), new TUnit_TestProject_DecimalArgumentTests_Equality4__decimal_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DecimalArgumentTests), new TUnit_TestProject_DecimalArgumentTests_ExplicitDecimalValue__decimal_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DecimalArgumentTests), new TUnit_TestProject_DecimalArgumentTests_MaxDecimal__decimal_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DecimalArgumentTests), new TUnit_TestProject_DecimalArgumentTests_MinDecimal__decimal_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DecimalArgumentTests), new TUnit_TestProject_DecimalArgumentTests_MultipleDecimals__decimal_decimal_decimal_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DecimalArgumentTests), new TUnit_TestProject_DecimalArgumentTests_SimpleDecimal__decimal_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DecimalArgumentTests), new TUnit_TestProject_DecimalArgumentTests_SmallDecimal__decimal_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DecimalArgumentTests), new TUnit_TestProject_DecimalArgumentTests_TestMethod__decimal_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DecimalArgumentTests), new TUnit_TestProject_DecimalArgumentTests_Test__decimal_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DecimalArgumentTests), new TUnit_TestProject_DecimalArgumentTests_TransactionDiscountCalculations__decimal_decima_54FB9799_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DecimalArgumentTests), new TUnit_TestProject_DecimalArgumentTests_Transfer__decimal_decimal_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.DecimalArgumentTests), new TUnit_TestProject_DecimalArgumentTests__TestSource()); } } 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 6ac3112a9b7..e8cb6263039 100644 --- a/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet10_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet10_0.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_BasicTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_SynchronousTest = new global::TUnit.Core.TestMetadata { TestName = "SynchronousTest", TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -44,11 +44,89 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SynchronousTest, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_SynchronousTest.UseRuntimeDataGeneration(testSessionId); + var metadata_AsynchronousTest = new global::TUnit.Core.TestMetadata + { + TestName = "AsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "AsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 11, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "AsynchronousTest", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsynchronousTest, + }; + metadata_AsynchronousTest.UseRuntimeDataGeneration(testSessionId); + var metadata_ValueTaskAsynchronousTest = new global::TUnit.Core.TestMetadata + { + TestName = "ValueTaskAsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "ValueTaskAsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 17, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "ValueTaskAsynchronousTest", + GenericTypeCount = 0, + ReturnType = typeof(global::System.Threading.Tasks.ValueTask), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.ValueTask)), + Parameters = global::System.Array.Empty(), + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ValueTaskAsynchronousTest, + }; + metadata_ValueTaskAsynchronousTest.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_SynchronousTest, metadata_AsynchronousTest, metadata_ValueTaskAsynchronousTest }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -65,17 +143,47 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_SynchronousTest + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", + ClassName = "BasicTests", + MethodName = "AsynchronousTest", + FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", + FilePath = @"", + LineNumber = 11, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_AsynchronousTest + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + ClassName = "BasicTests", + MethodName = "ValueTaskAsynchronousTest", + FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + FilePath = @"", + LineNumber = 17, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_ValueTaskAsynchronousTest }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ new global::TUnit.Core.TestAttribute() ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_SynchronousTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -87,44 +195,52 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata { - TestName = "AsynchronousTest", + TestName = "SynchronousTest", TestClassType = typeof(global::TUnit.TestProject.BasicTests), - TestMethodName = "AsynchronousTest", + TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 11, + LineNumber = 5, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.BasicTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "AsynchronousTest", + Name = "SynchronousTest", GenericTypeCount = 0, - ReturnType = typeof(global::System.Threading.Tasks.Task), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { @@ -138,63 +254,56 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SynchronousTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsynchronousTest(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", - ClassName = "BasicTests", - MethodName = "AsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", + TestName = "AsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "AsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", LineNumber = 11, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "AsynchronousTest", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsynchronousTest, }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_ValueTaskAsynchronousTest(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -202,7 +311,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "ValueTaskAsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -231,62 +340,12 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ValueTaskAsynchronousTest, }; 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.BasicTests.ValueTaskAsynchronousTest", - ClassName = "BasicTests", - MethodName = "ValueTaskAsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - FilePath = @"", - LineNumber = 17, - 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() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return instance.ValueTaskAsynchronousTest(); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_BasicTests__ClassHelper -{ internal static global::TUnit.TestProject.BasicTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.BasicTests(); @@ -294,8 +353,6 @@ internal static class TUnit_TestProject_BasicTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_AsynchronousTest_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_SynchronousTest_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests__TestSource()); } } 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 6ac3112a9b7..e8cb6263039 100644 --- a/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet8_0.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_BasicTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_SynchronousTest = new global::TUnit.Core.TestMetadata { TestName = "SynchronousTest", TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -44,11 +44,89 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SynchronousTest, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_SynchronousTest.UseRuntimeDataGeneration(testSessionId); + var metadata_AsynchronousTest = new global::TUnit.Core.TestMetadata + { + TestName = "AsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "AsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 11, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "AsynchronousTest", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsynchronousTest, + }; + metadata_AsynchronousTest.UseRuntimeDataGeneration(testSessionId); + var metadata_ValueTaskAsynchronousTest = new global::TUnit.Core.TestMetadata + { + TestName = "ValueTaskAsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "ValueTaskAsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 17, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "ValueTaskAsynchronousTest", + GenericTypeCount = 0, + ReturnType = typeof(global::System.Threading.Tasks.ValueTask), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.ValueTask)), + Parameters = global::System.Array.Empty(), + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ValueTaskAsynchronousTest, + }; + metadata_ValueTaskAsynchronousTest.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_SynchronousTest, metadata_AsynchronousTest, metadata_ValueTaskAsynchronousTest }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -65,17 +143,47 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_SynchronousTest + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", + ClassName = "BasicTests", + MethodName = "AsynchronousTest", + FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", + FilePath = @"", + LineNumber = 11, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_AsynchronousTest + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + ClassName = "BasicTests", + MethodName = "ValueTaskAsynchronousTest", + FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + FilePath = @"", + LineNumber = 17, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_ValueTaskAsynchronousTest }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ new global::TUnit.Core.TestAttribute() ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_SynchronousTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -87,44 +195,52 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata { - TestName = "AsynchronousTest", + TestName = "SynchronousTest", TestClassType = typeof(global::TUnit.TestProject.BasicTests), - TestMethodName = "AsynchronousTest", + TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 11, + LineNumber = 5, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.BasicTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "AsynchronousTest", + Name = "SynchronousTest", GenericTypeCount = 0, - ReturnType = typeof(global::System.Threading.Tasks.Task), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { @@ -138,63 +254,56 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SynchronousTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsynchronousTest(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", - ClassName = "BasicTests", - MethodName = "AsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", + TestName = "AsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "AsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", LineNumber = 11, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "AsynchronousTest", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsynchronousTest, }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_ValueTaskAsynchronousTest(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -202,7 +311,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "ValueTaskAsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -231,62 +340,12 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ValueTaskAsynchronousTest, }; 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.BasicTests.ValueTaskAsynchronousTest", - ClassName = "BasicTests", - MethodName = "ValueTaskAsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - FilePath = @"", - LineNumber = 17, - 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() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return instance.ValueTaskAsynchronousTest(); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_BasicTests__ClassHelper -{ internal static global::TUnit.TestProject.BasicTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.BasicTests(); @@ -294,8 +353,6 @@ internal static class TUnit_TestProject_BasicTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_AsynchronousTest_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_SynchronousTest_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests__TestSource()); } } 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 6ac3112a9b7..e8cb6263039 100644 --- a/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.DotNet9_0.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_BasicTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_SynchronousTest = new global::TUnit.Core.TestMetadata { TestName = "SynchronousTest", TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -44,11 +44,89 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SynchronousTest, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_SynchronousTest.UseRuntimeDataGeneration(testSessionId); + var metadata_AsynchronousTest = new global::TUnit.Core.TestMetadata + { + TestName = "AsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "AsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 11, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "AsynchronousTest", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsynchronousTest, + }; + metadata_AsynchronousTest.UseRuntimeDataGeneration(testSessionId); + var metadata_ValueTaskAsynchronousTest = new global::TUnit.Core.TestMetadata + { + TestName = "ValueTaskAsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "ValueTaskAsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 17, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "ValueTaskAsynchronousTest", + GenericTypeCount = 0, + ReturnType = typeof(global::System.Threading.Tasks.ValueTask), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.ValueTask)), + Parameters = global::System.Array.Empty(), + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ValueTaskAsynchronousTest, + }; + metadata_ValueTaskAsynchronousTest.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_SynchronousTest, metadata_AsynchronousTest, metadata_ValueTaskAsynchronousTest }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -65,17 +143,47 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_SynchronousTest + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", + ClassName = "BasicTests", + MethodName = "AsynchronousTest", + FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", + FilePath = @"", + LineNumber = 11, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_AsynchronousTest + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + ClassName = "BasicTests", + MethodName = "ValueTaskAsynchronousTest", + FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + FilePath = @"", + LineNumber = 17, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_ValueTaskAsynchronousTest }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ new global::TUnit.Core.TestAttribute() ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_SynchronousTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -87,44 +195,52 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata { - TestName = "AsynchronousTest", + TestName = "SynchronousTest", TestClassType = typeof(global::TUnit.TestProject.BasicTests), - TestMethodName = "AsynchronousTest", + TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 11, + LineNumber = 5, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.BasicTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "AsynchronousTest", + Name = "SynchronousTest", GenericTypeCount = 0, - ReturnType = typeof(global::System.Threading.Tasks.Task), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { @@ -138,63 +254,56 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SynchronousTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsynchronousTest(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", - ClassName = "BasicTests", - MethodName = "AsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", + TestName = "AsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "AsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", LineNumber = 11, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "AsynchronousTest", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsynchronousTest, }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_ValueTaskAsynchronousTest(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -202,7 +311,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "ValueTaskAsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -231,62 +340,12 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ValueTaskAsynchronousTest, }; 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.BasicTests.ValueTaskAsynchronousTest", - ClassName = "BasicTests", - MethodName = "ValueTaskAsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - FilePath = @"", - LineNumber = 17, - 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() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return instance.ValueTaskAsynchronousTest(); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_BasicTests__ClassHelper -{ internal static global::TUnit.TestProject.BasicTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.BasicTests(); @@ -294,8 +353,6 @@ internal static class TUnit_TestProject_BasicTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_AsynchronousTest_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_SynchronousTest_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests__TestSource()); } } 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 abf00eea2c1..f717b59d6f0 100644 --- a/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.Net4_7.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/DisableReflectionScannerTests.Test.Net4_7.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_BasicTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_SynchronousTest = new global::TUnit.Core.TestMetadata { TestName = "SynchronousTest", TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -44,11 +44,89 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SynchronousTest, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_SynchronousTest.UseRuntimeDataGeneration(testSessionId); + var metadata_AsynchronousTest = new global::TUnit.Core.TestMetadata + { + TestName = "AsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "AsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 11, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "AsynchronousTest", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsynchronousTest, + }; + metadata_AsynchronousTest.UseRuntimeDataGeneration(testSessionId); + var metadata_ValueTaskAsynchronousTest = new global::TUnit.Core.TestMetadata + { + TestName = "ValueTaskAsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "ValueTaskAsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 17, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "ValueTaskAsynchronousTest", + GenericTypeCount = 0, + ReturnType = typeof(global::System.Threading.Tasks.ValueTask), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.ValueTask)), + Parameters = global::System.Array.Empty(), + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ValueTaskAsynchronousTest, + }; + metadata_ValueTaskAsynchronousTest.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_SynchronousTest, metadata_AsynchronousTest, metadata_ValueTaskAsynchronousTest }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -65,17 +143,47 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_SynchronousTest + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", + ClassName = "BasicTests", + MethodName = "AsynchronousTest", + FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", + FilePath = @"", + LineNumber = 11, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_AsynchronousTest + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + ClassName = "BasicTests", + MethodName = "ValueTaskAsynchronousTest", + FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", + FilePath = @"", + LineNumber = 17, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_ValueTaskAsynchronousTest }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ new global::TUnit.Core.TestAttribute() ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_SynchronousTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -87,44 +195,52 @@ internal sealed class TUnit_TestProject_BasicTests_SynchronousTest_TestSource : return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata { - TestName = "AsynchronousTest", + TestName = "SynchronousTest", TestClassType = typeof(global::TUnit.TestProject.BasicTests), - TestMethodName = "AsynchronousTest", + TestMethodName = "SynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 11, + LineNumber = 5, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.BasicTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), - Name = "AsynchronousTest", + Name = "SynchronousTest", GenericTypeCount = 0, - ReturnType = typeof(global::System.Threading.Tasks.Task), - ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), Parameters = global::System.Array.Empty(), Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.BasicTests", new global::TUnit.Core.ClassMetadata { @@ -138,63 +254,56 @@ internal sealed class TUnit_TestProject_BasicTests_AsynchronousTest_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SynchronousTest, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_AsynchronousTest(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.BasicTests.AsynchronousTest", - ClassName = "BasicTests", - MethodName = "AsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.AsynchronousTest", + TestName = "AsynchronousTest", + TestClassType = typeof(global::TUnit.TestProject.BasicTests), + TestMethodName = "AsynchronousTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", LineNumber = 11, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.BasicTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.BasicTests)), + Name = "AsynchronousTest", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AsynchronousTest, }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.AsynchronousTest()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_ValueTaskAsynchronousTest(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -202,7 +311,7 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes TestClassType = typeof(global::TUnit.TestProject.BasicTests), TestMethodName = "ValueTaskAsynchronousTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -231,62 +340,12 @@ internal sealed class TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_Tes Parent = null }) }, - InstanceFactory = TUnit_TestProject_BasicTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ValueTaskAsynchronousTest, }; 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.BasicTests.ValueTaskAsynchronousTest", - ClassName = "BasicTests", - MethodName = "ValueTaskAsynchronousTest", - FullyQualifiedName = "TUnit.TestProject.BasicTests.ValueTaskAsynchronousTest", - FilePath = @"", - LineNumber = 17, - 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() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.BasicTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return instance.ValueTaskAsynchronousTest(); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_BasicTests__ClassHelper -{ internal static global::TUnit.TestProject.BasicTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.BasicTests(); @@ -294,8 +353,6 @@ internal static class TUnit_TestProject_BasicTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_AsynchronousTest_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_SynchronousTest_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests_ValueTaskAsynchronousTest_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.BasicTests), new TUnit_TestProject_BasicTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/EnumMemberNamesTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/EnumMemberNamesTests.Test.verified.txt index 81f0807c252..29065a57e69 100644 --- a/TUnit.Core.SourceGenerator.Tests/EnumMemberNamesTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/EnumMemberNamesTests.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_Bugs__1432_EnumMemberNamesTests_SomeTest__string_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_Bugs__1432_EnumMemberNamesTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_SomeTest__string = new global::TUnit.Core.TestMetadata { TestName = "SomeTest", TestClassType = typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests), TestMethodName = "SomeTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("A"), @@ -58,11 +58,11 @@ internal sealed class TUnit_TestProject_Bugs__1432_EnumMemberNamesTests_SomeTest Parent = null }) }, - InstanceFactory = TUnit_TestProject_Bugs__1432_EnumMemberNamesTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SomeTest__string, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_SomeTest__string.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_SomeTest__string }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -79,10 +79,10 @@ internal sealed class TUnit_TestProject_Bugs__1432_EnumMemberNamesTests_SomeTest HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_SomeTest__string }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -90,7 +90,7 @@ internal sealed class TUnit_TestProject_Bugs__1432_EnumMemberNamesTests_SomeTest new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_SomeTest__string(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -110,20 +110,63 @@ internal sealed class TUnit_TestProject_Bugs__1432_EnumMemberNamesTests_SomeTest return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_Bugs__1432_EnumMemberNamesTests__ClassHelper -{ + private static global::System.Collections.Generic.IReadOnlyList __Materialize_SomeTest__string(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "SomeTest", + TestClassType = typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests), + TestMethodName = "SomeTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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"), + }, + 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 + { + Type = typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests)), + Name = "SomeTest", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests).GetMethod("SomeTest", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SomeTest__string, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } internal static global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests(); @@ -131,6 +174,6 @@ internal static class TUnit_TestProject_Bugs__1432_EnumMemberNamesTests__ClassHe [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests), new TUnit_TestProject_Bugs__1432_EnumMemberNamesTests_SomeTest__string_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._1432.EnumMemberNamesTests), new TUnit_TestProject_Bugs__1432_EnumMemberNamesTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/EnumerableDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/EnumerableDataSourceDrivenTests.Test.verified.txt index 0b6872f8b37..e7934125012 100644 --- a/TUnit.Core.SourceGenerator.Tests/EnumerableDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/EnumerableDataSourceDrivenTests.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_EnumerableDataSourceDrivenTests_DataSource_Method__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_EnumerableDataSourceDrivenTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_DataSource_Method__int = new global::TUnit.Core.TestMetadata { TestName = "DataSource_Method", TestClassType = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests), TestMethodName = "DataSource_Method", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -77,11 +77,155 @@ internal sealed class TUnit_TestProject_EnumerableDataSourceDrivenTests_DataSour Parent = null }) }, - InstanceFactory = TUnit_TestProject_EnumerableDataSourceDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method__int, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_DataSource_Method__int.UseRuntimeDataGeneration(testSessionId); + var metadata_DataSource_Method2__int = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_Method2", + TestClassType = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests), + TestMethodName = "DataSource_Method2", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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.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(); + } + }, + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 15, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests)), + Name = "DataSource_Method2", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests).GetMethod("DataSource_Method2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.EnumerableDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method2__int, + }; + metadata_DataSource_Method2__int.UseRuntimeDataGeneration(testSessionId); + var metadata_DataSource_WithBaseReturn__BaseValue = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_WithBaseReturn", + TestClassType = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests), + TestMethodName = "DataSource_WithBaseReturn", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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(); + } + }, + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 22, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests)), + Name = "DataSource_WithBaseReturn", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests.BaseValue)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests.BaseValue)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests).GetMethod("DataSource_WithBaseReturn", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests.BaseValue) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.EnumerableDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_WithBaseReturn__BaseValue, + }; + metadata_DataSource_WithBaseReturn__BaseValue.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_DataSource_Method__int, metadata_DataSource_Method2__int, metadata_DataSource_WithBaseReturn__BaseValue }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -98,10 +242,40 @@ internal sealed class TUnit_TestProject_EnumerableDataSourceDrivenTests_DataSour HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_DataSource_Method__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.EnumerableDataSourceDrivenTests.DataSource_Method2", + ClassName = "EnumerableDataSourceDrivenTests", + MethodName = "DataSource_Method2", + FullyQualifiedName = "TUnit.TestProject.EnumerableDataSourceDrivenTests.DataSource_Method2", + FilePath = @"", + LineNumber = 15, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_DataSource_Method2__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.EnumerableDataSourceDrivenTests.DataSource_WithBaseReturn", + ClassName = "EnumerableDataSourceDrivenTests", + MethodName = "DataSource_WithBaseReturn", + FullyQualifiedName = "TUnit.TestProject.EnumerableDataSourceDrivenTests.DataSource_WithBaseReturn", + FilePath = @"", + LineNumber = 22, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_DataSource_WithBaseReturn__BaseValue }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -109,7 +283,7 @@ internal sealed class TUnit_TestProject_EnumerableDataSourceDrivenTests_DataSour new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.EnumerableDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method__int(global::TUnit.TestProject.EnumerableDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -128,29 +302,54 @@ internal sealed class TUnit_TestProject_EnumerableDataSourceDrivenTests_DataSour return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_EnumerableDataSourceDrivenTests_DataSource_Method2__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata { - TestName = "DataSource_Method2", + TestName = "DataSource_Method", TestClassType = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests), - TestMethodName = "DataSource_Method2", + TestMethodName = "DataSource_Method", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -181,12 +380,12 @@ internal sealed class TUnit_TestProject_EnumerableDataSourceDrivenTests_DataSour PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 15, + LineNumber = 8, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests)), - Name = "DataSource_Method2", + Name = "DataSource_Method", GenericTypeCount = 0, ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), @@ -197,7 +396,7 @@ internal sealed class TUnit_TestProject_EnumerableDataSourceDrivenTests_DataSour Name = "value", TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests).GetMethod("DataSource_Method2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + ReflectionInfo = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests).GetMethod("DataSource_Method", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } }, Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.EnumerableDataSourceDrivenTests", new global::TUnit.Core.ClassMetadata @@ -212,72 +411,89 @@ internal sealed class TUnit_TestProject_EnumerableDataSourceDrivenTests_DataSour Parent = null }) }, - InstanceFactory = TUnit_TestProject_EnumerableDataSourceDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method__int, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method2__int(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.EnumerableDataSourceDrivenTests.DataSource_Method2", - ClassName = "EnumerableDataSourceDrivenTests", - MethodName = "DataSource_Method2", - FullyQualifiedName = "TUnit.TestProject.EnumerableDataSourceDrivenTests.DataSource_Method2", + TestName = "DataSource_Method2", + TestClassType = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests), + TestMethodName = "DataSource_Method2", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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.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(); + } + }, + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", LineNumber = 15, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.EnumerableDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) + MethodMetadata = new global::TUnit.Core.MethodMetadata { - case 1: + Type = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests)), + Name = "DataSource_Method2", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) { - return new global::System.Threading.Tasks.ValueTask(instance.DataSource_Method2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests).GetMethod("DataSource_Method2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } + }, + Class = 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method2__int, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_EnumerableDataSourceDrivenTests_DataSource_WithBaseReturn__BaseValue_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_WithBaseReturn__BaseValue(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -285,7 +501,7 @@ internal sealed class TUnit_TestProject_EnumerableDataSourceDrivenTests_DataSour TestClassType = typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests), TestMethodName = "DataSource_WithBaseReturn", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("MethodWithBaseReturn") @@ -347,72 +563,12 @@ internal sealed class TUnit_TestProject_EnumerableDataSourceDrivenTests_DataSour Parent = null }) }, - InstanceFactory = TUnit_TestProject_EnumerableDataSourceDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_WithBaseReturn__BaseValue, }; 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.EnumerableDataSourceDrivenTests.DataSource_WithBaseReturn", - ClassName = "EnumerableDataSourceDrivenTests", - MethodName = "DataSource_WithBaseReturn", - FullyQualifiedName = "TUnit.TestProject.EnumerableDataSourceDrivenTests.DataSource_WithBaseReturn", - FilePath = @"", - LineNumber = 22, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.EnumerableDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_WithBaseReturn(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_EnumerableDataSourceDrivenTests__ClassHelper -{ internal static global::TUnit.TestProject.EnumerableDataSourceDrivenTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.EnumerableDataSourceDrivenTests(); @@ -420,8 +576,6 @@ internal static class TUnit_TestProject_EnumerableDataSourceDrivenTests__ClassHe [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests), new TUnit_TestProject_EnumerableDataSourceDrivenTests_DataSource_Method2__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests), new TUnit_TestProject_EnumerableDataSourceDrivenTests_DataSource_Method__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests), new TUnit_TestProject_EnumerableDataSourceDrivenTests_DataSource_WithBaseReturn__BaseValue_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.EnumerableDataSourceDrivenTests), new TUnit_TestProject_EnumerableDataSourceDrivenTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/EnumerableTupleDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/EnumerableTupleDataSourceDrivenTests.Test.verified.txt index 05c7b646437..343a7566c0b 100644 --- a/TUnit.Core.SourceGenerator.Tests/EnumerableTupleDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/EnumerableTupleDataSourceDrivenTests.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_EnumerableTupleDataSourceDrivenTests_DataSource_TupleMethod__int_string_bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_EnumerableTupleDataSourceDrivenTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_DataSource_TupleMethod__int_string_bool = new global::TUnit.Core.TestMetadata { TestName = "DataSource_TupleMethod", TestClassType = typeof(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests), TestMethodName = "DataSource_TupleMethod", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") @@ -113,11 +113,11 @@ internal sealed class TUnit_TestProject_EnumerableTupleDataSourceDrivenTests_Dat Parent = null }) }, - InstanceFactory = TUnit_TestProject_EnumerableTupleDataSourceDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_TupleMethod__int_string_bool, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_DataSource_TupleMethod__int_string_bool.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_DataSource_TupleMethod__int_string_bool }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -134,10 +134,10 @@ internal sealed class TUnit_TestProject_EnumerableTupleDataSourceDrivenTests_Dat HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_DataSource_TupleMethod__int_string_bool }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -145,7 +145,7 @@ internal sealed class TUnit_TestProject_EnumerableTupleDataSourceDrivenTests_Dat new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + 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) { try { @@ -165,20 +165,118 @@ internal sealed class TUnit_TestProject_EnumerableTupleDataSourceDrivenTests_Dat return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_EnumerableTupleDataSourceDrivenTests__ClassHelper -{ + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_TupleMethod__int_string_bool(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_TupleMethod", + TestClassType = typeof(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests), + TestMethodName = "DataSource_TupleMethod", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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.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 + { + 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.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(); + } + }, + }, + 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 + { + Type = typeof(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests)), + Name = "DataSource_TupleMethod", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.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] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "value2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string), typeof(bool) }, null)!.GetParameters()[1] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "value3", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string), typeof(bool) }, null)!.GetParameters()[2] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_TupleMethod__int_string_bool, + }; + metadata.UseRuntimeDataGeneration(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(); @@ -186,6 +284,6 @@ internal static class TUnit_TestProject_EnumerableTupleDataSourceDrivenTests__Cl [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests), new TUnit_TestProject_EnumerableTupleDataSourceDrivenTests_DataSource_TupleMethod__int_string_bool_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.EnumerableTupleDataSourceDrivenTests), new TUnit_TestProject_EnumerableTupleDataSourceDrivenTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/ExpectedArgumentTypeTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/ExpectedArgumentTypeTests.Test.verified.txt index 22498b6753f..cc8ca736d61 100644 --- a/TUnit.Core.SourceGenerator.Tests/ExpectedArgumentTypeTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/ExpectedArgumentTypeTests.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_ExpectedArgumentTypeTests_TypedArguments__object_Type_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_ExpectedArgumentTypeTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_TypedArguments__object_Type = new global::TUnit.Core.TestMetadata { TestName = "TypedArguments", TestClassType = typeof(global::TUnit.TestProject.ExpectedArgumentTypeTests), TestMethodName = "TypedArguments", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(0d, typeof(double)), @@ -75,11 +75,83 @@ internal sealed class TUnit_TestProject_ExpectedArgumentTypeTests_TypedArguments Parent = null }) }, - InstanceFactory = TUnit_TestProject_ExpectedArgumentTypeTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_TypedArguments__object_Type, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_TypedArguments__object_Type.UseRuntimeDataGeneration(testSessionId); + var metadata_EnumTypes__object_Type_Type = new global::TUnit.Core.TestMetadata + { + TestName = "EnumTypes", + TestClassType = typeof(global::TUnit.TestProject.ExpectedArgumentTypeTests), + TestMethodName = "EnumTypes", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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)), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 25, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.ExpectedArgumentTypeTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ExpectedArgumentTypeTests)), + Name = "EnumTypes", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(object)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(object)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ExpectedArgumentTypeTests).GetMethod("EnumTypes", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(object), typeof(global::System.Type), typeof(global::System.Type) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(global::System.Type)) + { + Name = "expectedValueType", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Type)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ExpectedArgumentTypeTests).GetMethod("EnumTypes", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(object), typeof(global::System.Type), typeof(global::System.Type) }, null)!.GetParameters()[1] + }, + new global::TUnit.Core.ParameterMetadata(typeof(global::System.Type)) + { + Name = "expectedEnumUnderlyingType", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Type)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ExpectedArgumentTypeTests).GetMethod("EnumTypes", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(object), typeof(global::System.Type), typeof(global::System.Type) }, null)!.GetParameters()[2] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ExpectedArgumentTypeTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_EnumTypes__object_Type_Type, + }; + metadata_EnumTypes__object_Type_Type.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_TypedArguments__object_Type, metadata_EnumTypes__object_Type_Type }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -96,10 +168,25 @@ internal sealed class TUnit_TestProject_ExpectedArgumentTypeTests_TypedArguments HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_TypedArguments__object_Type + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.ExpectedArgumentTypeTests.EnumTypes", + ClassName = "ExpectedArgumentTypeTests", + MethodName = "EnumTypes", + FullyQualifiedName = "TUnit.TestProject.ExpectedArgumentTypeTests.EnumTypes", + FilePath = @"", + LineNumber = 25, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_EnumTypes__object_Type_Type }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -107,7 +194,7 @@ internal sealed class TUnit_TestProject_ExpectedArgumentTypeTests_TypedArguments new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ExpectedArgumentTypeTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_TypedArguments__object_Type(global::TUnit.TestProject.ExpectedArgumentTypeTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -126,21 +213,100 @@ internal sealed class TUnit_TestProject_ExpectedArgumentTypeTests_TypedArguments return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_ExpectedArgumentTypeTests_EnumTypes__object_Type_Type_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata + { + TestName = "TypedArguments", + TestClassType = typeof(global::TUnit.TestProject.ExpectedArgumentTypeTests), + TestMethodName = "TypedArguments", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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)), + }, + 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 + { + Type = typeof(global::TUnit.TestProject.ExpectedArgumentTypeTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ExpectedArgumentTypeTests)), + Name = "TypedArguments", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(object)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(object)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ExpectedArgumentTypeTests).GetMethod("TypedArguments", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(object), typeof(global::System.Type) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(global::System.Type)) + { + Name = "expectedType", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Type)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.ExpectedArgumentTypeTests).GetMethod("TypedArguments", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(object), typeof(global::System.Type) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.ExpectedArgumentTypeTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_TypedArguments__object_Type, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_EnumTypes__object_Type_Type(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -148,7 +314,7 @@ internal sealed class TUnit_TestProject_ExpectedArgumentTypeTests_EnumTypes__obj TestClassType = typeof(global::TUnit.TestProject.ExpectedArgumentTypeTests), TestMethodName = "EnumTypes", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(global::TUnit.TestProject.ByteEnum.Default, typeof(global::TUnit.TestProject.ByteEnum), typeof(byte)), @@ -210,71 +376,12 @@ internal sealed class TUnit_TestProject_ExpectedArgumentTypeTests_EnumTypes__obj Parent = null }) }, - InstanceFactory = TUnit_TestProject_ExpectedArgumentTypeTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_EnumTypes__object_Type_Type, }; 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.ExpectedArgumentTypeTests.EnumTypes", - ClassName = "ExpectedArgumentTypeTests", - MethodName = "EnumTypes", - FullyQualifiedName = "TUnit.TestProject.ExpectedArgumentTypeTests.EnumTypes", - FilePath = @"", - LineNumber = 25, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ExpectedArgumentTypeTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 3: - { - return new global::System.Threading.Tasks.ValueTask(instance.EnumTypes(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_ExpectedArgumentTypeTests__ClassHelper -{ internal static global::TUnit.TestProject.ExpectedArgumentTypeTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.ExpectedArgumentTypeTests(); @@ -282,7 +389,6 @@ internal static class TUnit_TestProject_ExpectedArgumentTypeTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ExpectedArgumentTypeTests), new TUnit_TestProject_ExpectedArgumentTypeTests_EnumTypes__object_Type_Type_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ExpectedArgumentTypeTests), new TUnit_TestProject_ExpectedArgumentTypeTests_TypedArguments__object_Type_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ExpectedArgumentTypeTests), new TUnit_TestProject_ExpectedArgumentTypeTests__TestSource()); } } 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 7d1cc5fe8c8..af329d36994 100644 --- a/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_EmptyGenericRegistry_WhenNoGenericsFound.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/GenericTypeResolverTests.Test_EmptyGenericRegistry_WhenNoGenericsFound.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_SimpleTestClass_NonGenericTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_SimpleTestClass__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_NonGenericTest = new global::TUnit.Core.TestMetadata { TestName = "NonGenericTest", TestClassType = typeof(global::TUnit.TestProject.SimpleTestClass), TestMethodName = "NonGenericTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -44,11 +44,11 @@ internal sealed class TUnit_TestProject_SimpleTestClass_NonGenericTest_TestSourc Parent = null }) }, - InstanceFactory = TUnit_TestProject_SimpleTestClass__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_NonGenericTest, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_NonGenericTest.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_NonGenericTest }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -65,17 +65,17 @@ internal sealed class TUnit_TestProject_SimpleTestClass_NonGenericTest_TestSourc HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_NonGenericTest }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ new global::TUnit.Core.TestAttribute() ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.SimpleTestClass instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_NonGenericTest(global::TUnit.TestProject.SimpleTestClass instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -87,20 +87,49 @@ internal sealed class TUnit_TestProject_SimpleTestClass_NonGenericTest_TestSourc return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_SimpleTestClass__ClassHelper -{ + private static global::System.Collections.Generic.IReadOnlyList __Materialize_NonGenericTest(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "NonGenericTest", + TestClassType = typeof(global::TUnit.TestProject.SimpleTestClass), + TestMethodName = "NonGenericTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 + { + Type = typeof(global::TUnit.TestProject.SimpleTestClass), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.SimpleTestClass)), + Name = "NonGenericTest", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_NonGenericTest, + }; + metadata.UseRuntimeDataGeneration(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(); @@ -108,6 +137,6 @@ internal static class TUnit_TestProject_SimpleTestClass__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.SimpleTestClass), new TUnit_TestProject_SimpleTestClass_NonGenericTest_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.SimpleTestClass), new TUnit_TestProject_SimpleTestClass__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/Hooks1589.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Hooks1589.Test.verified.txt index 864a6b44465..fa51e8004f7 100644 --- a/TUnit.Core.SourceGenerator.Tests/Hooks1589.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Hooks1589.Test.verified.txt @@ -5,22 +5,22 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_Bugs__1589_MyTests_Test1_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_Bugs__1589_MyTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_Test1 = new global::TUnit.Core.TestMetadata { TestName = "Test1", TestClassType = typeof(global::TUnit.TestProject.Bugs._1589.MyTests), TestMethodName = "Test1", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ClassDataSourceAttribute() -{Shared = global::TUnit.Core.SharedType.None,}, + {Shared = global::TUnit.Core.SharedType.None,}, }, PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), @@ -57,11 +57,11 @@ internal sealed class TUnit_TestProject_Bugs__1589_MyTests_Test1_TestSource : gl Parent = null }) }, - InstanceFactory = TUnit_TestProject_Bugs__1589_MyTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test1, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_Test1.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_Test1 }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -78,20 +78,20 @@ internal sealed class TUnit_TestProject_Bugs__1589_MyTests_Test1_TestSource : gl HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_Test1 }; } - private static global::System.Attribute[] __CreateAttributes() + 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,} + {Shared = global::TUnit.Core.SharedType.None,} ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1589.MyTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_Test1(global::TUnit.TestProject.Bugs._1589.MyTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -102,20 +102,62 @@ internal sealed class TUnit_TestProject_Bugs__1589_MyTests_Test1_TestSource : gl return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_Bugs__1589_MyTests__ClassHelper -{ + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test1(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "Test1", + TestClassType = typeof(global::TUnit.TestProject.Bugs._1589.MyTests), + TestMethodName = "Test1", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ClassDataSourceAttribute() + {Shared = global::TUnit.Core.SharedType.None,}, + }, + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 15, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._1589.MyTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1589.MyTests)), + Name = "Test1", + 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._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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Bugs._1589.MyFixture)) + { + Name = "myFixture", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1589.MyFixture)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1589.MyTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.Bugs._1589.MyFixture) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test1, + }; + metadata.UseRuntimeDataGeneration(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])); @@ -123,6 +165,6 @@ internal static class TUnit_TestProject_Bugs__1589_MyTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._1589.MyTests), new TUnit_TestProject_Bugs__1589_MyTests_Test1_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._1589.MyTests), new TUnit_TestProject_Bugs__1589_MyTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/Hooks1594.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Hooks1594.Test.verified.txt index 81d5a1667c9..23642148afc 100644 --- a/TUnit.Core.SourceGenerator.Tests/Hooks1594.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Hooks1594.Test.verified.txt @@ -5,22 +5,22 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_Bugs__1594_MyTests_Test1_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_Bugs__1594_MyTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_Test1 = new global::TUnit.Core.TestMetadata { TestName = "Test1", TestClassType = typeof(global::TUnit.TestProject.Bugs._1594.MyTests), TestMethodName = "Test1", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ClassDataSourceAttribute() -{Shared = global::TUnit.Core.SharedType.None,}, + {Shared = global::TUnit.Core.SharedType.None,}, }, PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), @@ -57,11 +57,11 @@ internal sealed class TUnit_TestProject_Bugs__1594_MyTests_Test1_TestSource : gl Parent = null }) }, - InstanceFactory = TUnit_TestProject_Bugs__1594_MyTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test1, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_Test1.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_Test1 }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -78,20 +78,20 @@ internal sealed class TUnit_TestProject_Bugs__1594_MyTests_Test1_TestSource : gl HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_Test1 }; } - private static global::System.Attribute[] __CreateAttributes() + 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,} + {Shared = global::TUnit.Core.SharedType.None,} ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1594.MyTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_Test1(global::TUnit.TestProject.Bugs._1594.MyTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -103,20 +103,62 @@ internal sealed class TUnit_TestProject_Bugs__1594_MyTests_Test1_TestSource : gl return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_Bugs__1594_MyTests__ClassHelper -{ + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test1(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "Test1", + TestClassType = typeof(global::TUnit.TestProject.Bugs._1594.MyTests), + TestMethodName = "Test1", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ClassDataSourceAttribute() + {Shared = global::TUnit.Core.SharedType.None,}, + }, + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 15, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._1594.MyTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1594.MyTests)), + 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._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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Bugs._1594.MyFixture)) + { + Name = "myFixture", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1594.MyFixture)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1594.MyTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.Bugs._1594.MyFixture) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test1, + }; + metadata.UseRuntimeDataGeneration(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])); @@ -124,6 +166,6 @@ internal static class TUnit_TestProject_Bugs__1594_MyTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._1594.MyTests), new TUnit_TestProject_Bugs__1594_MyTests_Test1_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._1594.MyTests), new TUnit_TestProject_Bugs__1594_MyTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/InheritedPropertySetterTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/InheritedPropertySetterTests.Test.verified.txt index b3e47633e0c..57cffa88c76 100644 --- a/TUnit.Core.SourceGenerator.Tests/InheritedPropertySetterTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/InheritedPropertySetterTests.Test.verified.txt @@ -5,7 +5,7 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_PropertySetterTests_Test_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_PropertySetterTests__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")] @@ -23,13 +23,13 @@ internal sealed class TUnit_TestProject_PropertySetterTests_Test_TestSource : gl #endif public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_Test = new global::TUnit.Core.TestMetadata { TestName = "Test", TestClassType = typeof(global::TUnit.TestProject.PropertySetterTests), TestMethodName = "Test", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = new global::TUnit.Core.PropertyDataSource[] @@ -62,21 +62,21 @@ internal sealed class TUnit_TestProject_PropertySetterTests_Test_TestSource : gl PropertyName = "Property4", PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), DataSource = new global::TUnit.Core.ClassDataSourceAttribute() -{Shared = global::TUnit.Core.SharedType.PerTestSession,}, + {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,}, + {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",}, + {Shared = global::TUnit.Core.SharedType.Keyed,Key = "Key",}, }, new global::TUnit.Core.PropertyDataSource { @@ -298,11 +298,11 @@ internal sealed class TUnit_TestProject_PropertySetterTests_Test_TestSource : gl Parent = null }) }, - InstanceFactory = TUnit_TestProject_PropertySetterTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_Test.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_Test }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -319,10 +319,10 @@ internal sealed class TUnit_TestProject_PropertySetterTests_Test_TestSource : gl HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_Test }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -331,7 +331,7 @@ internal sealed class TUnit_TestProject_PropertySetterTests_Test_TestSource : gl new global::TUnit.Core.NotInParallelAttribute("PropertySetterTests") ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.PropertySetterTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_Test(global::TUnit.TestProject.PropertySetterTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -342,20 +342,289 @@ internal sealed class TUnit_TestProject_PropertySetterTests_Test_TestSource : gl return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_PropertySetterTests__ClassHelper -{ + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "Test", + TestClassType = typeof(global::TUnit.TestProject.PropertySetterTests), + TestMethodName = "Test", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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") + { + 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(); + } + }, + 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 = 0, + FilePath = @"", + LineNumber = 69, + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test, + }; + metadata.UseRuntimeDataGeneration(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() @@ -372,7 +641,7 @@ internal static class TUnit_TestProject_PropertySetterTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.PropertySetterTests), new TUnit_TestProject_PropertySetterTests_Test_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.PropertySetterTests), new TUnit_TestProject_PropertySetterTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/InheritedTestsFromDifferentProjectTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/InheritedTestsFromDifferentProjectTests.Test.verified.txt index 096bbe2ef49..94b503a38c9 100644 --- a/TUnit.Core.SourceGenerator.Tests/InheritedTestsFromDifferentProjectTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/InheritedTestsFromDifferentProjectTests.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_Test_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_Test = new global::TUnit.Core.TestMetadata { TestName = "Test", TestClassType = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), TestMethodName = "Test", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -44,75 +44,17 @@ internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ Parent = null }) }, - InstanceFactory = TUnit_TestProject_InheritedTestsFromDifferentProjectTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test, }; - 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.Test", - ClassName = "InheritedTestsFromDifferentProjectTests", - MethodName = "Test", - FullyQualifiedName = "TUnit.TestProject.InheritedTestsFromDifferentProjectTests.Test", - FilePath = @"", - LineNumber = 9, - 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(Pass), - new global::TUnit.Core.InheritsTestsAttribute(), - new global::TUnit.Core.CategoryAttribute("BaseCategoriesOnClass") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - instance.Test(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_GenericMethodDataSource__string_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_Test.UseRuntimeDataGeneration(testSessionId); + var metadata_GenericMethodDataSource__string = new global::TUnit.Core.TestMetadata { TestName = "GenericMethodDataSource", TestClassType = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), TestMethodName = "GenericMethodDataSource", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("Foo"), @@ -153,14 +95,130 @@ internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ Parent = null }) }, - InstanceFactory = TUnit_TestProject_InheritedTestsFromDifferentProjectTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_GenericMethodDataSource__string, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_GenericMethodDataSource__string.UseRuntimeDataGeneration(testSessionId); + var metadata_NonGenericMethodDataSource__string = new global::TUnit.Core.TestMetadata + { + TestName = "NonGenericMethodDataSource", + TestClassType = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), + TestMethodName = "NonGenericMethodDataSource", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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(); + } + }, + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 20, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests)), + Name = "NonGenericMethodDataSource", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests).GetMethod("NonGenericMethodDataSource", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests", 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_NonGenericMethodDataSource__string, + }; + metadata_NonGenericMethodDataSource__string.UseRuntimeDataGeneration(testSessionId); + var metadata_VerifyInheritedCategoriesAreAvailable = new global::TUnit.Core.TestMetadata + { + TestName = "VerifyInheritedCategoriesAreAvailable", + TestClassType = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), + TestMethodName = "VerifyInheritedCategoriesAreAvailable", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 26, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests)), + Name = "VerifyInheritedCategoriesAreAvailable", + 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.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_VerifyInheritedCategoriesAreAvailable, + }; + metadata_VerifyInheritedCategoriesAreAvailable.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_Test, metadata_GenericMethodDataSource__string, metadata_NonGenericMethodDataSource__string, metadata_VerifyInheritedCategoriesAreAvailable }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.InheritedTestsFromDifferentProjectTests.Test", + ClassName = "InheritedTestsFromDifferentProjectTests", + MethodName = "Test", + FullyQualifiedName = "TUnit.TestProject.InheritedTestsFromDifferentProjectTests.Test", + FilePath = @"", + LineNumber = 9, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Test + }; yield return new global::TUnit.Core.TestDescriptor { TestId = "TUnit.TestProject.InheritedTestsFromDifferentProjectTests.GenericMethodDataSource", @@ -174,10 +232,40 @@ internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_GenericMethodDataSource__string + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.InheritedTestsFromDifferentProjectTests.NonGenericMethodDataSource", + ClassName = "InheritedTestsFromDifferentProjectTests", + MethodName = "NonGenericMethodDataSource", + FullyQualifiedName = "TUnit.TestProject.InheritedTestsFromDifferentProjectTests.NonGenericMethodDataSource", + FilePath = @"", + LineNumber = 20, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_NonGenericMethodDataSource__string + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.InheritedTestsFromDifferentProjectTests.VerifyInheritedCategoriesAreAvailable", + ClassName = "InheritedTestsFromDifferentProjectTests", + MethodName = "VerifyInheritedCategoriesAreAvailable", + FullyQualifiedName = "TUnit.TestProject.InheritedTestsFromDifferentProjectTests.VerifyInheritedCategoriesAreAvailable", + FilePath = @"", + LineNumber = 26, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_VerifyInheritedCategoriesAreAvailable }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -187,7 +275,19 @@ internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ new global::TUnit.Core.CategoryAttribute("BaseCategoriesOnClass") ]; } - 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 __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 { @@ -207,21 +307,136 @@ internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_NonGenericMethodDataSource__string_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata + { + TestName = "Test", + TestClassType = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), + TestMethodName = "Test", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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.InheritedTestsFromDifferentProjectTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests)), + Name = "Test", + 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_Test, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_GenericMethodDataSource__string(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "GenericMethodDataSource", + TestClassType = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), + TestMethodName = "GenericMethodDataSource", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.MethodDataSourceAttribute("Foo"), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 14, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests)), + Name = "GenericMethodDataSource", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests).GetMethod("GenericMethodDataSource", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests", 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_GenericMethodDataSource__string, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_NonGenericMethodDataSource__string(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -229,7 +444,7 @@ internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ TestClassType = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), TestMethodName = "NonGenericMethodDataSource", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute(typeof(global::TUnit.TestProject.TestData), "Foo") @@ -281,75 +496,13 @@ internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ Parent = null }) }, - InstanceFactory = TUnit_TestProject_InheritedTestsFromDifferentProjectTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_NonGenericMethodDataSource__string, }; 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.NonGenericMethodDataSource", - ClassName = "InheritedTestsFromDifferentProjectTests", - MethodName = "NonGenericMethodDataSource", - FullyQualifiedName = "TUnit.TestProject.InheritedTestsFromDifferentProjectTests.NonGenericMethodDataSource", - FilePath = @"", - LineNumber = 20, - 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(Pass), - new global::TUnit.Core.InheritsTestsAttribute(), - new global::TUnit.Core.CategoryAttribute("BaseCategoriesOnClass") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.NonGenericMethodDataSource(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_VerifyInheritedCategoriesAreAvailable_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_VerifyInheritedCategoriesAreAvailable(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -357,7 +510,7 @@ internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ TestClassType = typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), TestMethodName = "VerifyInheritedCategoriesAreAvailable", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -386,65 +539,12 @@ internal sealed class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ Parent = null }) }, - InstanceFactory = TUnit_TestProject_InheritedTestsFromDifferentProjectTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_VerifyInheritedCategoriesAreAvailable, }; 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.VerifyInheritedCategoriesAreAvailable", - ClassName = "InheritedTestsFromDifferentProjectTests", - MethodName = "VerifyInheritedCategoriesAreAvailable", - FullyQualifiedName = "TUnit.TestProject.InheritedTestsFromDifferentProjectTests.VerifyInheritedCategoriesAreAvailable", - FilePath = @"", - LineNumber = 26, - 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(Pass), - new global::TUnit.Core.InheritsTestsAttribute(), - new global::TUnit.Core.CategoryAttribute("BaseCategoriesOnClass") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.VerifyInheritedCategoriesAreAvailable()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_InheritedTestsFromDifferentProjectTests__ClassHelper -{ internal static global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests(); @@ -452,10 +552,7 @@ internal static class TUnit_TestProject_InheritedTestsFromDifferentProjectTests_ [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), new TUnit_TestProject_InheritedTestsFromDifferentProjectTests_GenericMethodDataSource__string_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), new TUnit_TestProject_InheritedTestsFromDifferentProjectTests_NonGenericMethodDataSource__string_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), new TUnit_TestProject_InheritedTestsFromDifferentProjectTests_Test_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), new TUnit_TestProject_InheritedTestsFromDifferentProjectTests_VerifyInheritedCategoriesAreAvailable_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.InheritedTestsFromDifferentProjectTests), new TUnit_TestProject_InheritedTestsFromDifferentProjectTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/InheritsTestsAbstractTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/InheritsTestsAbstractTests.Test.verified.txt index 12c928eb63e..c7e2e2fb8f4 100644 --- a/TUnit.Core.SourceGenerator.Tests/InheritsTestsAbstractTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/InheritsTestsAbstractTests.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_SecondTest = new global::TUnit.Core.TestMetadata { TestName = "SecondTest", TestClassType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), TestMethodName = "SecondTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -44,11 +44,11 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_ Parent = null }) }, - InstanceFactory = TUnit_TestProject_AbstractTests_ConcreteClass2__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SecondTest, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_SecondTest.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_SecondTest }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -65,10 +65,10 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_ HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_SecondTest }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -77,7 +77,7 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_ new global::TUnit.Core.InheritsTestsAttribute() ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AbstractTests.ConcreteClass2 instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_SecondTest(global::TUnit.TestProject.AbstractTests.ConcreteClass2 instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -89,20 +89,49 @@ internal sealed class TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_ return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_AbstractTests_ConcreteClass2__ClassHelper -{ + private static global::System.Collections.Generic.IReadOnlyList __Materialize_SecondTest(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "SecondTest", + TestClassType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), + TestMethodName = "SecondTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 11, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2)), + Name = "SecondTest", + 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.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_SecondTest, + }; + metadata.UseRuntimeDataGeneration(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(); @@ -110,7 +139,7 @@ internal static class TUnit_TestProject_AbstractTests_ConcreteClass2__ClassHelpe [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), new TUnit_TestProject_AbstractTests_ConcreteClass2_SecondTest_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), new TUnit_TestProject_AbstractTests_ConcreteClass2__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/InheritsTestsAbstractTests.cs b/TUnit.Core.SourceGenerator.Tests/InheritsTestsAbstractTests.cs index bbc1548bcc3..ea0238a8f6b 100644 --- a/TUnit.Core.SourceGenerator.Tests/InheritsTestsAbstractTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/InheritsTestsAbstractTests.cs @@ -33,7 +33,7 @@ public Task Test() => TestMetadataGenerator.RunTest(Path.Combine(Git.RootDirecto // Verify ConcreteClass2 has both inherited test and its own test var hasConcreteClass2InheritedTest = testFiles.Any(f => f.Contains("ConcreteClass2_AssertClassName")); - var hasConcreteClass2OwnTest = testFiles.Any(f => f.Contains("ConcreteClass2_SecondTest")); + var hasConcreteClass2OwnTest = testFiles.Any(f => f.Contains("ConcreteClass2__TestSource") && f.Contains("SecondTest")); await Assert.That(hasConcreteClass2InheritedTest).IsTrue(); await Assert.That(hasConcreteClass2OwnTest).IsTrue(); diff --git a/TUnit.Core.SourceGenerator.Tests/InheritsTestsTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/InheritsTestsTests.Test.verified.txt index a8e551db533..fdea4a53102 100644 --- a/TUnit.Core.SourceGenerator.Tests/InheritsTestsTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/InheritsTestsTests.Test.verified.txt @@ -5,7 +5,7 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_Bugs__1924_None_BaseClass_Test__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_Bugs__1924_None_BaseClass__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")] @@ -13,14 +13,13 @@ internal sealed class TUnit_TestProject_Bugs__1924_None_BaseClass_Test__int_Test #endif public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_Test__int = new global::TUnit.Core.TestMetadata { TestName = "Test", TestClassType = typeof(global::TUnit.TestProject.Bugs._1924.None.BaseClass), TestMethodName = "Test", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 10, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1), @@ -102,11 +101,12 @@ internal sealed class TUnit_TestProject_Bugs__1924_None_BaseClass_Test__int_Test Parent = null }) }, - InstanceFactory = TUnit_TestProject_Bugs__1924_None_BaseClass__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test__int, + RepeatCount = 10, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_Test__int.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_Test__int }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -123,10 +123,10 @@ internal sealed class TUnit_TestProject_Bugs__1924_None_BaseClass_Test__int_Test HasDataSource = true, RepeatCount = 10, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_Test__int }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -135,7 +135,7 @@ internal sealed class TUnit_TestProject_Bugs__1924_None_BaseClass_Test__int_Test new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1924.None.BaseClass instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + 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) { try { @@ -154,20 +154,103 @@ internal sealed class TUnit_TestProject_Bugs__1924_None_BaseClass_Test__int_Test return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_Bugs__1924_None_BaseClass__ClassHelper -{ + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test__int(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "Test", + TestClassType = typeof(global::TUnit.TestProject.Bugs._1924.None.BaseClass), + TestMethodName = "Test", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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), + }, + 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[] + { + 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 = 0, + FilePath = @"", + LineNumber = 11, + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1924.None.BaseClass).GetMethod("Test", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1924.None.BaseClass", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test__int, + RepeatCount = 10, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } internal static global::TUnit.TestProject.Bugs._1924.None.BaseClass CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.Bugs._1924.None.BaseClass() @@ -178,7 +261,7 @@ internal static class TUnit_TestProject_Bugs__1924_None_BaseClass__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._1924.None.BaseClass), new TUnit_TestProject_Bugs__1924_None_BaseClass_Test__int_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._1924.None.BaseClass), new TUnit_TestProject_Bugs__1924_None_BaseClass__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/InheritsTestsTests.cs b/TUnit.Core.SourceGenerator.Tests/InheritsTestsTests.cs index 6c559cb05ed..4261697a545 100644 --- a/TUnit.Core.SourceGenerator.Tests/InheritsTestsTests.cs +++ b/TUnit.Core.SourceGenerator.Tests/InheritsTestsTests.cs @@ -28,7 +28,7 @@ public Task Test() => TestMetadataGenerator.RunTest(Path.Combine(Git.RootDirecto var hasTests1 = generatedFiles.Any(f => f.Contains("Tests_Test_") && !f.Contains("Tests2") && !f.Contains("Tests3")); var hasTests2 = generatedFiles.Any(f => f.Contains("Tests2_Test_")); var hasTests3 = generatedFiles.Any(f => f.Contains("Tests3_Test_")); - var hasBaseClass = generatedFiles.Any(f => f.Contains("BaseClass_Test_")); + var hasBaseClass = generatedFiles.Any(f => f.Contains("BaseClass__TestSource")); await Assert.That(hasBaseClass).IsTrue(); await Assert.That(hasTests1).IsTrue(); diff --git a/TUnit.Core.SourceGenerator.Tests/Issue2887Tests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Issue2887Tests.Test.verified.txt index ade96ae30a2..2d22731cd92 100644 --- a/TUnit.Core.SourceGenerator.Tests/Issue2887Tests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Issue2887Tests.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_Bugs__Issue2887_ActualTestClass_Test1_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_Bugs__Issue2887_ActualTestClass__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_Test1 = new global::TUnit.Core.TestMetadata { TestName = "Test1", TestClassType = typeof(global::TUnit.TestProject.Bugs._Issue2887.ActualTestClass), TestMethodName = "Test1", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -53,11 +53,11 @@ internal sealed class TUnit_TestProject_Bugs__Issue2887_ActualTestClass_Test1_Te Parent = null }) }, - InstanceFactory = TUnit_TestProject_Bugs__Issue2887_ActualTestClass__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test1, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_Test1.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_Test1 }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -74,10 +74,10 @@ internal sealed class TUnit_TestProject_Bugs__Issue2887_ActualTestClass_Test1_Te HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_Test1 }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -85,7 +85,7 @@ internal sealed class TUnit_TestProject_Bugs__Issue2887_ActualTestClass_Test1_Te new global::TUnit.Core.ClassConstructorAttribute() ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._Issue2887.ActualTestClass instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_Test1(global::TUnit.TestProject.Bugs._Issue2887.ActualTestClass instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -97,20 +97,58 @@ internal sealed class TUnit_TestProject_Bugs__Issue2887_ActualTestClass_Test1_Te return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_Bugs__Issue2887_ActualTestClass__ClassHelper -{ + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test1(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "Test1", + TestClassType = typeof(global::TUnit.TestProject.Bugs._Issue2887.ActualTestClass), + TestMethodName = "Test1", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 26, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._Issue2887.ActualTestClass), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._Issue2887.ActualTestClass)), + 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._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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Bugs._Issue2887.IServiceProvider)) + { + Name = "serviceProvider", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._Issue2887.IServiceProvider)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._Issue2887.ActualTestClass).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.Bugs._Issue2887.IServiceProvider) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test1, + }; + metadata.UseRuntimeDataGeneration(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 @@ -119,6 +157,6 @@ internal static class TUnit_TestProject_Bugs__Issue2887_ActualTestClass__ClassHe [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._Issue2887.ActualTestClass), new TUnit_TestProject_Bugs__Issue2887_ActualTestClass_Test1_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._Issue2887.ActualTestClass), new TUnit_TestProject_Bugs__Issue2887_ActualTestClass__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/MatrixTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/MatrixTests.Test.verified.txt index 59d87cef946..a937decb6ed 100644 --- a/TUnit.Core.SourceGenerator.Tests/MatrixTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/MatrixTests.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_MatrixTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_MatrixTest_One__string_int_bool = new global::TUnit.Core.TestMetadata { TestName = "MatrixTest_One", TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "MatrixTest_One", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -70,80 +70,17 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_b Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.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.MatrixTests.MatrixTest_One", - ClassName = "MatrixTests", - MethodName = "MatrixTest_One", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_One", - FilePath = @"", - LineNumber = 9, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixTest_One__string_int_bool, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 3: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_One(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_MatrixTest_One__string_int_bool.UseRuntimeDataGeneration(testSessionId); + var metadata_MatrixTest_Two__int_int_int_bool = new global::TUnit.Core.TestMetadata { TestName = "MatrixTest_Two", TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "MatrixTest_Two", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -205,80 +142,17 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_ Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.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.MatrixTests.MatrixTest_Two", - ClassName = "MatrixTests", - MethodName = "MatrixTest_Two", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_Two", - FilePath = @"", - LineNumber = 19, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixTest_Two__int_int_int_bool, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 4: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_Two(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 4 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnum_TestEnum__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_MatrixTest_Two__int_int_int_bool.UseRuntimeDataGeneration(testSessionId); + var metadata_MatrixTest_Enum__int_TestEnum_TestEnum_ = new global::TUnit.Core.TestMetadata { TestName = "MatrixTest_Enum", TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "MatrixTest_Enum", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -333,80 +207,17 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnu Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.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.MatrixTests.MatrixTest_Enum", - ClassName = "MatrixTests", - MethodName = "MatrixTest_Enum", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_Enum", - FilePath = @"", - LineNumber = 30, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixTest_Enum__int_TestEnum_TestEnum_, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 3: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixTest_Enum(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 3 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_MatrixTest_Enum__int_TestEnum_TestEnum_.UseRuntimeDataGeneration(testSessionId); + var metadata_AutoGenerateBools__string_bool = new global::TUnit.Core.TestMetadata { TestName = "AutoGenerateBools", TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "AutoGenerateBools", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -454,80 +265,17 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bo Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.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.MatrixTests.AutoGenerateBools", - ClassName = "MatrixTests", - MethodName = "AutoGenerateBools", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.AutoGenerateBools", - FilePath = @"", - LineNumber = 40, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AutoGenerateBools__string_bool, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.AutoGenerateBools(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_bool__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_AutoGenerateBools__string_bool.UseRuntimeDataGeneration(testSessionId); + var metadata_AutoGenerateBools2__string_bool_ = new global::TUnit.Core.TestMetadata { TestName = "AutoGenerateBools2", TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "AutoGenerateBools2", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -575,80 +323,17 @@ internal sealed class TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_b Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AutoGenerateBools2__string_bool_, }; - 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.MatrixTests.AutoGenerateBools2", - ClassName = "MatrixTests", - MethodName = "AutoGenerateBools2", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.AutoGenerateBools2", - FilePath = @"", - LineNumber = 49, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.AutoGenerateBools2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_AutoGenerateBools2__string_bool_.UseRuntimeDataGeneration(testSessionId); + var metadata_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool = new global::TUnit.Core.TestMetadata { TestName = "ImplicitConversion", TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "ImplicitConversion", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -696,80 +381,17 @@ internal sealed class TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_Te Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.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.MatrixTests.ImplicitConversion", - ClassName = "MatrixTests", - MethodName = "ImplicitConversion", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.ImplicitConversion", - FilePath = @"", - LineNumber = 58, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.ImplicitConversion(global::TUnit.Core.Helpers.CastHelper.Cast>(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool.UseRuntimeDataGeneration(testSessionId); + var metadata_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool = new global::TUnit.Core.TestMetadata { TestName = "ExcludingAutoGeneratedMatrixValues", TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "ExcludingAutoGeneratedMatrixValues", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -817,80 +439,17 @@ internal sealed class TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrix Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.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.MatrixTests.ExcludingAutoGeneratedMatrixValues", - ClassName = "MatrixTests", - MethodName = "ExcludingAutoGeneratedMatrixValues", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.ExcludingAutoGeneratedMatrixValues", - FilePath = @"", - LineNumber = 67, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.ExcludingAutoGeneratedMatrixValues(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_Method1__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool.UseRuntimeDataGeneration(testSessionId); + var metadata_Method1__int = new global::TUnit.Core.TestMetadata { TestName = "Method1", TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Method1", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -931,80 +490,17 @@ internal sealed class TUnit_TestProject_MatrixTests_Method1__int_TestSource : gl Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.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.MatrixTests.Method1", - ClassName = "MatrixTests", - MethodName = "Method1", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method1", - FilePath = @"", - LineNumber = 116, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Method1__int, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Method1(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_Method2__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_Method1__int.UseRuntimeDataGeneration(testSessionId); + var metadata_Method2__int = new global::TUnit.Core.TestMetadata { TestName = "Method2", TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Method2", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1045,72 +541,1267 @@ internal sealed class TUnit_TestProject_MatrixTests_Method2__int_TestSource : gl Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Method2__int, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor + metadata_Method2__int.UseRuntimeDataGeneration(testSessionId); + var metadata_Method3__int = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.MatrixTests.Method2", - ClassName = "MatrixTests", - MethodName = "Method2", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method2", + TestName = "Method3", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "Method3", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, FilePath = @"", - LineNumber = 124, - 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() - { + LineNumber = 132, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "Method3", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "item", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method3", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Method3__int, + }; + metadata_Method3__int.UseRuntimeDataGeneration(testSessionId); + var metadata_Method4__int = new global::TUnit.Core.TestMetadata + { + TestName = "Method4", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "Method4", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 140, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "Method4", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "item", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method4", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Method4__int, + }; + metadata_Method4__int.UseRuntimeDataGeneration(testSessionId); + var metadata_Exclusion__int_int = new global::TUnit.Core.TestMetadata + { + TestName = "Exclusion", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "Exclusion", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_1, + 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 = 0, + FilePath = @"", + LineNumber = 148, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "Exclusion", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "item", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Exclusion", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "item2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Exclusion", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Exclusion__int_int, + }; + metadata_Exclusion__int_int.UseRuntimeDataGeneration(testSessionId); + var metadata_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum = new global::TUnit.Core.TestMetadata + { + TestName = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 197, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "flag", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool), typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)) + { + Name = "enum", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool), typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum, + }; + metadata_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum.UseRuntimeDataGeneration(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 }; + } + public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + { + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.MatrixTest_One", + ClassName = "MatrixTests", + MethodName = "MatrixTest_One", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_One", + FilePath = @"", + LineNumber = 9, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_MatrixTest_One__string_int_bool + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.MatrixTest_Two", + ClassName = "MatrixTests", + MethodName = "MatrixTest_Two", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_Two", + FilePath = @"", + LineNumber = 19, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_MatrixTest_Two__int_int_int_bool + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.MatrixTest_Enum", + ClassName = "MatrixTests", + MethodName = "MatrixTest_Enum", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixTest_Enum", + FilePath = @"", + LineNumber = 30, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_MatrixTest_Enum__int_TestEnum_TestEnum_ + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.AutoGenerateBools", + ClassName = "MatrixTests", + MethodName = "AutoGenerateBools", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.AutoGenerateBools", + FilePath = @"", + LineNumber = 40, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_AutoGenerateBools__string_bool + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.AutoGenerateBools2", + ClassName = "MatrixTests", + MethodName = "AutoGenerateBools2", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.AutoGenerateBools2", + FilePath = @"", + LineNumber = 49, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_AutoGenerateBools2__string_bool_ + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.ImplicitConversion", + ClassName = "MatrixTests", + MethodName = "ImplicitConversion", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.ImplicitConversion", + FilePath = @"", + LineNumber = 58, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.ExcludingAutoGeneratedMatrixValues", + ClassName = "MatrixTests", + MethodName = "ExcludingAutoGeneratedMatrixValues", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.ExcludingAutoGeneratedMatrixValues", + FilePath = @"", + LineNumber = 67, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.Method1", + ClassName = "MatrixTests", + MethodName = "Method1", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method1", + FilePath = @"", + LineNumber = 116, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Method1__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.Method2", + ClassName = "MatrixTests", + MethodName = "Method2", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method2", + FilePath = @"", + LineNumber = 124, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Method2__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.Method3", + ClassName = "MatrixTests", + MethodName = "Method3", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method3", + FilePath = @"", + LineNumber = 132, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Method3__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.Method4", + ClassName = "MatrixTests", + MethodName = "Method4", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method4", + FilePath = @"", + LineNumber = 140, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Method4__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.Exclusion", + ClassName = "MatrixTests", + MethodName = "Exclusion", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.Exclusion", + FilePath = @"", + LineNumber = 148, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Exclusion__int_int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MatrixTests.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", + ClassName = "MatrixTests", + MethodName = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", + FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", + FilePath = @"", + LineNumber = 197, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + 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(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + 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 metadata = new global::TUnit.Core.TestMetadata + { + TestName = "MatrixTest_One", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "MatrixTest_One", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 9, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTest_One", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "str", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(int), typeof(bool) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "i", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(int), typeof(bool) }, null)!.GetParameters()[1] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "boolean", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_One", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(int), typeof(bool) }, null)!.GetParameters()[2] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixTest_One__string_int_bool, + }; + metadata.UseRuntimeDataGeneration(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 metadata = new global::TUnit.Core.TestMetadata + { + TestName = "MatrixTest_Two", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "MatrixTest_Two", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 19, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTest_Two", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "i", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int), typeof(int), typeof(bool) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "i2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int), typeof(int), typeof(bool) }, null)!.GetParameters()[1] + }, + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "i3", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int), typeof(int), typeof(bool) }, null)!.GetParameters()[2] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "boolean", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Two", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int), typeof(int), typeof(bool) }, null)!.GetParameters()[3] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixTest_Two__int_int_int_bool, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_MatrixTest_Enum__int_TestEnum_TestEnum_(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "MatrixTest_Enum", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "MatrixTest_Enum", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 30, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "MatrixTest_Enum", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "i", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Enum", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(global::TUnit.TestProject.TestEnum), typeof(global::TUnit.TestProject.TestEnum?) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.TestEnum)) + { + Name = "testEnum", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TestEnum)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Enum", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(global::TUnit.TestProject.TestEnum), typeof(global::TUnit.TestProject.TestEnum?) }, null)!.GetParameters()[1] + }, + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.TestEnum?)) + { + Name = "testEnum2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TestEnum?)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("MatrixTest_Enum", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(global::TUnit.TestProject.TestEnum), typeof(global::TUnit.TestProject.TestEnum?) }, null)!.GetParameters()[2] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixTest_Enum__int_TestEnum_TestEnum_, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_AutoGenerateBools__string_bool(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "AutoGenerateBools", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "AutoGenerateBools", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 40, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "AutoGenerateBools", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "str", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("AutoGenerateBools", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(bool) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "boolean", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("AutoGenerateBools", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(bool) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AutoGenerateBools__string_bool, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_AutoGenerateBools2__string_bool_(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "AutoGenerateBools2", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "AutoGenerateBools2", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 49, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "AutoGenerateBools2", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "str", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("AutoGenerateBools2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(bool?) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool?)) + { + Name = "boolean", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool?)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("AutoGenerateBools2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(bool?) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_AutoGenerateBools2__string_bool_, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool(string testSessionId) { - try + var metadata = new global::TUnit.Core.TestMetadata { - switch (args.Length) + TestName = "ImplicitConversion", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "ImplicitConversion", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] { - case 1: + new global::TUnit.Core.MatrixDataSourceAttribute(), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 58, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "ImplicitConversion", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(OneOf)) { - return new global::System.Threading.Tasks.ValueTask(instance.Method2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + Name = "enum", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(OneOf)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("ImplicitConversion", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(OneOf), typeof(bool) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "boolean", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("ImplicitConversion", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(OneOf), typeof(bool) }, null)!.GetParameters()[1] } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) + }, + Class = 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } + TestName = "ExcludingAutoGeneratedMatrixValues", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "ExcludingAutoGeneratedMatrixValues", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 67, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "ExcludingAutoGeneratedMatrixValues", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)) + { + Name = "enum", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("ExcludingAutoGeneratedMatrixValues", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), typeof(bool) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "boolean", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("ExcludingAutoGeneratedMatrixValues", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.MatrixTests.CountToTenEnum), typeof(bool) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Method1__int(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "Method1", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "Method1", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 116, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "Method1", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "item", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method1", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Method1__int, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Method2__int(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "Method2", + TestClassType = typeof(global::TUnit.TestProject.MatrixTests), + TestMethodName = "Method2", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 124, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MatrixTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MatrixTests)), + Name = "Method2", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "item", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MatrixTests).GetMethod("Method2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MatrixTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Method2__int, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Method3__int(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -1118,7 +1809,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : gl TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Method3", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1159,72 +1850,13 @@ internal sealed class TUnit_TestProject_MatrixTests_Method3__int_TestSource : gl Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Method3__int, }; 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.MatrixTests.Method3", - ClassName = "MatrixTests", - MethodName = "Method3", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method3", - FilePath = @"", - LineNumber = 132, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Method3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Method4__int(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -1232,7 +1864,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : gl TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Method4", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1273,72 +1905,13 @@ internal sealed class TUnit_TestProject_MatrixTests_Method4__int_TestSource : gl Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Method4__int, }; 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.MatrixTests.Method4", - ClassName = "MatrixTests", - MethodName = "Method4", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Method4", - FilePath = @"", - LineNumber = 140, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.Method4(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Exclusion__int_int(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -1346,7 +1919,7 @@ internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSourc TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "Exclusion", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_1, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1394,75 +1967,13 @@ internal sealed class TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSourc Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Exclusion__int_int, }; 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.MatrixTests.Exclusion", - ClassName = "MatrixTests", - MethodName = "Exclusion", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.Exclusion", - FilePath = @"", - LineNumber = 148, - 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.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(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)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__boo_38BEEE8F_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -1470,7 +1981,7 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParamet TestClassType = typeof(global::TUnit.TestProject.MatrixTests), TestMethodName = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -1518,71 +2029,12 @@ internal sealed class TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParamet Parent = null }) }, - InstanceFactory = TUnit_TestProject_MatrixTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__bool_CountToTenEnum, }; 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.MatrixTests.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", - ClassName = "MatrixTests", - MethodName = "MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", - FullyQualifiedName = "TUnit.TestProject.MatrixTests.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues", - FilePath = @"", - LineNumber = 197, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MatrixTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 2: - { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixMethod_WithEnumParameter_UsesOnlyMethodValues(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_MatrixTests__ClassHelper -{ internal static global::TUnit.TestProject.MatrixTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.MatrixTests(); @@ -1590,18 +2042,6 @@ internal static class TUnit_TestProject_MatrixTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_AutoGenerateBools2__string_bool__TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_AutoGenerateBools__string_bool_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_ExcludingAutoGeneratedMatrixValues__CountToTenEnum_bool_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Exclusion__int_int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_ImplicitConversion__OneOf_TestEnum__TestEnum2__bool_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_MatrixMethod_WithEnumParameter_UsesOnlyMethodValues__boo_38BEEE8F_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_MatrixTest_Enum__int_TestEnum_TestEnum__TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_MatrixTest_One__string_int_bool_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_MatrixTest_Two__int_int_int_bool_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Method1__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Method2__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Method3__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests_Method4__int_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MatrixTests), new TUnit_TestProject_MatrixTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenTests.Test.verified.txt index 1086e4d1c16..08eb716621b 100644 --- a/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenTests.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_DataSource_Method__int = new global::TUnit.Core.TestMetadata { TestName = "DataSource_Method", TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -67,81 +67,17 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.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.MethodDataSourceDrivenTests.DataSource_Method", - ClassName = "MethodDataSourceDrivenTests", - MethodName = "DataSource_Method", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method", - FilePath = @"", - LineNumber = 12, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method__int, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method2__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_Method__int.UseRuntimeDataGeneration(testSessionId); + var metadata_DataSource_Method2__int = new global::TUnit.Core.TestMetadata { TestName = "DataSource_Method2", TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method2", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -193,81 +129,17 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.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.MethodDataSourceDrivenTests.DataSource_Method2", - ClassName = "MethodDataSourceDrivenTests", - MethodName = "DataSource_Method2", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method2", - FilePath = @"", - LineNumber = 19, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method2__int, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method_WithAction__Action_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_Method2__int.UseRuntimeDataGeneration(testSessionId); + var metadata_DataSource_Method_WithAction__Action = new global::TUnit.Core.TestMetadata { TestName = "DataSource_Method_WithAction", TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method_WithAction", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeAction") @@ -319,81 +191,17 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.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.MethodDataSourceDrivenTests.DataSource_Method_WithAction", - ClassName = "MethodDataSourceDrivenTests", - MethodName = "DataSource_Method_WithAction", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method_WithAction", - FilePath = @"", - LineNumber = 26, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method_WithAction__Action, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method_WithAction(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method3__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_Method_WithAction__Action.UseRuntimeDataGeneration(testSessionId); + var metadata_DataSource_Method3__int = new global::TUnit.Core.TestMetadata { TestName = "DataSource_Method3", TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method3", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -460,81 +268,17 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.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.MethodDataSourceDrivenTests.DataSource_Method3", - ClassName = "MethodDataSourceDrivenTests", - MethodName = "DataSource_Method3", - FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method3", - FilePath = @"", - LineNumber = 33, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method3__int, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method4__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_Method3__int.UseRuntimeDataGeneration(testSessionId); + var metadata_DataSource_Method4__int = new global::TUnit.Core.TestMetadata { TestName = "DataSource_Method4", TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_Method4", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SomeMethod") @@ -628,81 +372,17 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_M Parent = null }) }, - InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method4__int, }; - 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.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 = GetTests - }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_Method4(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_WithBaseReturn__BaseValue_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_Method4__int.UseRuntimeDataGeneration(testSessionId); + var metadata_DataSource_WithBaseReturn__BaseValue = new global::TUnit.Core.TestMetadata { TestName = "DataSource_WithBaseReturn", TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "DataSource_WithBaseReturn", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("MethodWithBaseReturn") @@ -754,81 +434,17 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_W Parent = null }) }, - InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.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.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 = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_WithBaseReturn__BaseValue, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.DataSource_WithBaseReturn(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFuncArrayTest__string___TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataSource_WithBaseReturn__BaseValue.UseRuntimeDataGeneration(testSessionId); + var metadata_EnumerableFuncArrayTest__string__ = new global::TUnit.Core.TestMetadata { TestName = "EnumerableFuncArrayTest", TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), TestMethodName = "EnumerableFuncArrayTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("EnumerableFuncArrayTestData") @@ -890,14 +506,104 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu Parent = null }) }, - InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_EnumerableFuncArrayTest__string__, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_EnumerableFuncArrayTest__string__.UseRuntimeDataGeneration(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__ }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method", + ClassName = "MethodDataSourceDrivenTests", + MethodName = "DataSource_Method", + FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method", + FilePath = @"", + LineNumber = 12, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_DataSource_Method__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method2", + ClassName = "MethodDataSourceDrivenTests", + MethodName = "DataSource_Method2", + FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method2", + FilePath = @"", + LineNumber = 19, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_DataSource_Method2__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method_WithAction", + ClassName = "MethodDataSourceDrivenTests", + MethodName = "DataSource_Method_WithAction", + FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method_WithAction", + FilePath = @"", + LineNumber = 26, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_DataSource_Method_WithAction__Action + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method3", + ClassName = "MethodDataSourceDrivenTests", + MethodName = "DataSource_Method3", + FullyQualifiedName = "TUnit.TestProject.MethodDataSourceDrivenTests.DataSource_Method3", + FilePath = @"", + LineNumber = 33, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + 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", @@ -911,10 +617,10 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_EnumerableFuncArrayTest__string__ }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -922,7 +628,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method__int(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -930,7 +636,8 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu { case 1: { - return new global::System.Threading.Tasks.ValueTask(instance.EnumerableFuncArrayTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + 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}"); @@ -941,20 +648,654 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFu return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper -{ + private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method2__int(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method_WithAction__Action(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method_WithAction(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method3__int(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method3(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_Method4__int(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_Method4(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest_DataSource_WithBaseReturn__BaseValue(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + instance.DataSource_WithBaseReturn(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); + return default(global::System.Threading.Tasks.ValueTask); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + private static global::System.Threading.Tasks.ValueTask __InvokeTest_EnumerableFuncArrayTest__string__(global::TUnit.TestProject.MethodDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + { + try + { + switch (args.Length) + { + case 1: + { + return new global::System.Threading.Tasks.ValueTask(instance.EnumerableFuncArrayTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + } + default: + throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); + } + } + catch (global::System.Exception ex) + { + return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); + } + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method__int(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_Method", + TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TestMethodName = "DataSource_Method", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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(); + } + }, + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 12, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "DataSource_Method", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method__int, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method2__int(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_Method2", + TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TestMethodName = "DataSource_Method2", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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(); + } + }, + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 19, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "DataSource_Method2", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method2__int, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method_WithAction__Action(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_Method_WithAction", + TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TestMethodName = "DataSource_Method_WithAction", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = 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(); + } + }, + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 26, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "DataSource_Method_WithAction", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::System.Action)) + { + Name = "action", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Action)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method_WithAction", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Action) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method_WithAction__Action, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method3__int(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_Method3", + TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TestMethodName = "DataSource_Method3", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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(); + } + }, + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 33, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "DataSource_Method3", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method3", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method3__int, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_Method4__int(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_Method4", + TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TestMethodName = "DataSource_Method4", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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[] { "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) => + { + 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!", 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)); + } + return Factory(); + } + }, + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 42, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "DataSource_Method4", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_Method4", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_Method4__int, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_WithBaseReturn__BaseValue(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_WithBaseReturn", + TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TestMethodName = "DataSource_WithBaseReturn", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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.MethodDataSourceDrivenTests.MethodWithBaseReturn(); + 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(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 53, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "DataSource_WithBaseReturn", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("DataSource_WithBaseReturn", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests.BaseValue) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_WithBaseReturn__BaseValue, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_EnumerableFuncArrayTest__string__(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "EnumerableFuncArrayTest", + TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TestMethodName = "EnumerableFuncArrayTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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(); + } + }, + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 59, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests)), + Name = "EnumerableFuncArrayTest", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string[])) + { + Name = "strings", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string[])), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests).GetMethod("EnumerableFuncArrayTest", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string[]) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_EnumerableFuncArrayTest__string__, + }; + metadata.UseRuntimeDataGeneration(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(); @@ -962,12 +1303,6 @@ internal static class TUnit_TestProject_MethodDataSourceDrivenTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method2__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method3__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method4__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method_WithAction__Action_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_Method__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_DataSource_WithBaseReturn__BaseValue_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests_EnumerableFuncArrayTest__string___TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenTests), new TUnit_TestProject_MethodDataSourceDrivenTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenWithCancellationTokenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenWithCancellationTokenTests.Test.verified.txt index b5eeb4d3b08..fda746e37ac 100644 --- a/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenWithCancellationTokenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/MethodDataSourceDrivenWithCancellationTokenTests.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MethodDataSourceDrivenWithCancellationTokenTests_MyTest__int_Cancell_DF7AA95A_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_MethodDataSourceDrivenWithCancellationTokenTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_MyTest__int_CancellationToken = new global::TUnit.Core.TestMetadata { TestName = "MyTest", TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests), TestMethodName = "MyTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("T") @@ -174,11 +174,11 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenWithCancellationTo Parent = null }) }, - InstanceFactory = TUnit_TestProject_MethodDataSourceDrivenWithCancellationTokenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MyTest__int_CancellationToken, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_MyTest__int_CancellationToken.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_MyTest__int_CancellationToken }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -195,10 +195,10 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenWithCancellationTo HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_MyTest__int_CancellationToken }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -207,7 +207,7 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenWithCancellationTo new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Usage", "TUnit0046:Return a `Func` rather than a ``") ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_MyTest__int_CancellationToken(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -228,20 +228,179 @@ internal sealed class TUnit_TestProject_MethodDataSourceDrivenWithCancellationTo return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_MethodDataSourceDrivenWithCancellationTokenTests__ClassHelper -{ + private static global::System.Collections.Generic.IReadOnlyList __Materialize_MyTest__int_CancellationToken(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "MyTest", + TestClassType = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests), + TestMethodName = "MyTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.MethodDataSourceAttribute("T") + { + Factory = (dataGeneratorMetadata) => + { + async global::System.Collections.Generic.IAsyncEnumerable>> Factory() + { + 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) + { + 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("EnumerableFuncT") + { + Factory = (dataGeneratorMetadata) => + { + 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(); + } + }, + 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") + { + 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(); + } + }, + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 12, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests)), + Name = "MyTest", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.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] + }, + new global::TUnit.Core.ParameterMetadata(typeof(global::System.Threading.CancellationToken)) + { + Name = "cancellationToken", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests).GetMethod("MyTest", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MyTest__int_CancellationToken, + }; + metadata.UseRuntimeDataGeneration(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(); @@ -249,6 +408,6 @@ internal static class TUnit_TestProject_MethodDataSourceDrivenWithCancellationTo [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests), new TUnit_TestProject_MethodDataSourceDrivenWithCancellationTokenTests_MyTest__int_Cancell_DF7AA95A_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MethodDataSourceDrivenWithCancellationTokenTests), new TUnit_TestProject_MethodDataSourceDrivenWithCancellationTokenTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/MultipleClassDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/MultipleClassDataSourceDrivenTests.Test.verified.txt index 9b481766db5..f15f7a387ef 100644 --- a/TUnit.Core.SourceGenerator.Tests/MultipleClassDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/MultipleClassDataSourceDrivenTests.Test.verified.txt @@ -5,22 +5,22 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MultipleClassDataSourceDrivenTests_Test1_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_MultipleClassDataSourceDrivenTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_Test1 = new global::TUnit.Core.TestMetadata { TestName = "Test1", TestClassType = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests), TestMethodName = "Test1", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), 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},}, + {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},}, }, PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), @@ -85,11 +85,91 @@ internal sealed class TUnit_TestProject_MultipleClassDataSourceDrivenTests_Test1 Parent = null }) }, - InstanceFactory = TUnit_TestProject_MultipleClassDataSourceDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test1, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_Test1.UseRuntimeDataGeneration(testSessionId); + var metadata_Test2 = new global::TUnit.Core.TestMetadata + { + TestName = "Test2", + TestClassType = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests), + TestMethodName = "Test2", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + 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},}, + }, + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 23, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests)), + Name = "Test2", + 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.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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1)) + { + Name = "inject1", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5) })!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2)) + { + Name = "inject2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5) })!.GetParameters()[1] + }, + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3)) + { + Name = "inject3", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5) })!.GetParameters()[2] + }, + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4)) + { + Name = "inject4", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5) })!.GetParameters()[3] + }, + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5)) + { + Name = "inject5", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5) })!.GetParameters()[4] + } + }, + Properties = global::System.Array.Empty(), + Parent = null + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test2, + }; + metadata_Test2.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_Test1, metadata_Test2 }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -106,20 +186,35 @@ internal sealed class TUnit_TestProject_MultipleClassDataSourceDrivenTests_Test1 HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_Test1 + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.MultipleClassDataSourceDrivenTests.Test2", + ClassName = "MultipleClassDataSourceDrivenTests", + MethodName = "Test2", + FullyQualifiedName = "TUnit.TestProject.MultipleClassDataSourceDrivenTests.Test2", + FilePath = @"", + LineNumber = 23, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Test2 }; } - private static global::System.Attribute[] __CreateAttributes() + 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},} + {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(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_Test1(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -131,45 +226,43 @@ internal sealed class TUnit_TestProject_MultipleClassDataSourceDrivenTests_Test1 return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_MultipleClassDataSourceDrivenTests_Test2_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata { - TestName = "Test2", + TestName = "Test1", TestClassType = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests), - TestMethodName = "Test2", + TestMethodName = "Test1", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), 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},}, + {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},}, }, PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 23, + LineNumber = 17, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests)), - Name = "Test2", + Name = "Test1", GenericTypeCount = 0, ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), @@ -223,66 +316,96 @@ internal sealed class TUnit_TestProject_MultipleClassDataSourceDrivenTests_Test2 Parent = null }) }, - InstanceFactory = TUnit_TestProject_MultipleClassDataSourceDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test1, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test2(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.MultipleClassDataSourceDrivenTests.Test2", - ClassName = "MultipleClassDataSourceDrivenTests", - MethodName = "Test2", - FullyQualifiedName = "TUnit.TestProject.MultipleClassDataSourceDrivenTests.Test2", + TestName = "Test2", + TestClassType = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests), + TestMethodName = "Test2", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + 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},}, + }, + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", LineNumber = 23, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests)), + Name = "Test2", + 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.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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1)) + { + Name = "inject1", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5) })!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2)) + { + Name = "inject2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5) })!.GetParameters()[1] + }, + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3)) + { + Name = "inject3", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5) })!.GetParameters()[2] + }, + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4)) + { + Name = "inject4", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5) })!.GetParameters()[3] + }, + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5)) + { + Name = "inject5", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject1), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject2), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject3), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject4), typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests.Inject5) })!.GetParameters()[4] + } + }, + Properties = global::System.Array.Empty(), + Parent = null + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test2, }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.ClassDataSourceAttribute() -{Shared = new global::TUnit.Core.SharedType[]{global::TUnit.Core.SharedType.None,global::TUnit.Core.SharedType.None,global::TUnit.Core.SharedType.None,global::TUnit.Core.SharedType.None,global::TUnit.Core.SharedType.None},} - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - instance.Test2(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_MultipleClassDataSourceDrivenTests__ClassHelper -{ 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])); @@ -290,7 +413,6 @@ internal static class TUnit_TestProject_MultipleClassDataSourceDrivenTests__Clas [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests), new TUnit_TestProject_MultipleClassDataSourceDrivenTests_Test1_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests), new TUnit_TestProject_MultipleClassDataSourceDrivenTests_Test2_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.MultipleClassDataSourceDrivenTests), new TUnit_TestProject_MultipleClassDataSourceDrivenTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/NameOfArgumentTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/NameOfArgumentTests.Test.verified.txt index 9930cd9aff6..47a61e19b9c 100644 --- a/TUnit.Core.SourceGenerator.Tests/NameOfArgumentTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/NameOfArgumentTests.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_NameOfArgumentTests_TestName__string_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_NameOfArgumentTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_TestName__string = new global::TUnit.Core.TestMetadata { TestName = "TestName", TestClassType = typeof(global::TUnit.TestProject.NameOfArgumentTests), TestMethodName = "TestName", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("TestName"), @@ -56,11 +56,11 @@ internal sealed class TUnit_TestProject_NameOfArgumentTests_TestName__string_Tes Parent = null }) }, - InstanceFactory = TUnit_TestProject_NameOfArgumentTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_TestName__string, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_TestName__string.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_TestName__string }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -77,10 +77,10 @@ internal sealed class TUnit_TestProject_NameOfArgumentTests_TestName__string_Tes HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_TestName__string }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -88,7 +88,7 @@ internal sealed class TUnit_TestProject_NameOfArgumentTests_TestName__string_Tes new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NameOfArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_TestName__string(global::TUnit.TestProject.NameOfArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -107,20 +107,61 @@ internal sealed class TUnit_TestProject_NameOfArgumentTests_TestName__string_Tes return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_NameOfArgumentTests__ClassHelper -{ + private static global::System.Collections.Generic.IReadOnlyList __Materialize_TestName__string(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "TestName", + TestClassType = typeof(global::TUnit.TestProject.NameOfArgumentTests), + TestMethodName = "TestName", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute("TestName"), + }, + 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 + { + Type = typeof(global::TUnit.TestProject.NameOfArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NameOfArgumentTests)), + Name = "TestName", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "name", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.NameOfArgumentTests).GetMethod("TestName", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NameOfArgumentTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_TestName__string, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } internal static global::TUnit.TestProject.NameOfArgumentTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.NameOfArgumentTests(); @@ -128,6 +169,6 @@ internal static class TUnit_TestProject_NameOfArgumentTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.NameOfArgumentTests), new TUnit_TestProject_NameOfArgumentTests_TestName__string_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.NameOfArgumentTests), new TUnit_TestProject_NameOfArgumentTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/NullableByteArgumentTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/NullableByteArgumentTests.Test.verified.txt index 901f221596b..df6b968c15b 100644 --- a/TUnit.Core.SourceGenerator.Tests/NullableByteArgumentTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/NullableByteArgumentTests.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_NullableByteArgumentTests_Test__byte__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_NullableByteArgumentTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_Test__byte_ = new global::TUnit.Core.TestMetadata { TestName = "Test", TestClassType = typeof(global::TUnit.TestProject.NullableByteArgumentTests), TestMethodName = "Test", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute((byte) 1), @@ -57,11 +57,70 @@ internal sealed class TUnit_TestProject_NullableByteArgumentTests_Test__byte__Te Parent = null }) }, - InstanceFactory = TUnit_TestProject_NullableByteArgumentTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test__byte_, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_Test__byte_.UseRuntimeDataGeneration(testSessionId); + var metadata_Test2__byte_byte_ = new global::TUnit.Core.TestMetadata + { + TestName = "Test2", + TestClassType = typeof(global::TUnit.TestProject.NullableByteArgumentTests), + TestMethodName = "Test2", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute((byte) 1, (byte) 1), + new global::TUnit.Core.ArgumentsAttribute((byte) 1, null), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 15, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.NullableByteArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NullableByteArgumentTests)), + Name = "Test2", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(byte)) + { + Name = "byte1", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(byte)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.NullableByteArgumentTests).GetMethod("Test2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(byte), typeof(byte?) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(byte?)) + { + Name = "byte2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(byte?)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.NullableByteArgumentTests).GetMethod("Test2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(byte), typeof(byte?) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NullableByteArgumentTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test2__byte_byte_, + }; + metadata_Test2__byte_byte_.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_Test__byte_, metadata_Test2__byte_byte_ }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -78,10 +137,25 @@ internal sealed class TUnit_TestProject_NullableByteArgumentTests_Test__byte__Te HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_Test__byte_ + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.NullableByteArgumentTests.Test2", + ClassName = "NullableByteArgumentTests", + MethodName = "Test2", + FullyQualifiedName = "TUnit.TestProject.NullableByteArgumentTests.Test2", + FilePath = @"", + LineNumber = 15, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Test2__byte_byte_ }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -89,7 +163,7 @@ internal sealed class TUnit_TestProject_NullableByteArgumentTests_Test__byte__Te new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NullableByteArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_Test__byte_(global::TUnit.TestProject.NullableByteArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -109,21 +183,83 @@ internal sealed class TUnit_TestProject_NullableByteArgumentTests_Test__byte__Te return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_NullableByteArgumentTests_Test2__byte_byte__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata + { + TestName = "Test", + TestClassType = typeof(global::TUnit.TestProject.NullableByteArgumentTests), + TestMethodName = "Test", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute((byte) 1), + new global::TUnit.Core.ArgumentsAttribute(null), + }, + 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 + { + Type = typeof(global::TUnit.TestProject.NullableByteArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NullableByteArgumentTests)), + Name = "Test", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(byte?)) + { + Name = "someByte", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(byte?)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.NullableByteArgumentTests).GetMethod("Test", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(byte?) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NullableByteArgumentTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test__byte_, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test2__byte_byte_(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -131,7 +267,7 @@ internal sealed class TUnit_TestProject_NullableByteArgumentTests_Test2__byte_by TestClassType = typeof(global::TUnit.TestProject.NullableByteArgumentTests), TestMethodName = "Test2", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute((byte) 1, (byte) 1), @@ -180,72 +316,12 @@ internal sealed class TUnit_TestProject_NullableByteArgumentTests_Test2__byte_by Parent = null }) }, - InstanceFactory = TUnit_TestProject_NullableByteArgumentTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test2__byte_byte_, }; 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.NullableByteArgumentTests.Test2", - ClassName = "NullableByteArgumentTests", - MethodName = "Test2", - FullyQualifiedName = "TUnit.TestProject.NullableByteArgumentTests.Test2", - FilePath = @"", - LineNumber = 15, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NullableByteArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 2: - { - instance.Test2(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 2 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_NullableByteArgumentTests__ClassHelper -{ internal static global::TUnit.TestProject.NullableByteArgumentTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.NullableByteArgumentTests(); @@ -253,7 +329,6 @@ internal static class TUnit_TestProject_NullableByteArgumentTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.NullableByteArgumentTests), new TUnit_TestProject_NullableByteArgumentTests_Test2__byte_byte__TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.NullableByteArgumentTests), new TUnit_TestProject_NullableByteArgumentTests_Test__byte__TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.NullableByteArgumentTests), new TUnit_TestProject_NullableByteArgumentTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.Test.verified.txt index 1e4b57de384..768e68be305 100644 --- a/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_NumberArgumentTests_Int__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_NumberArgumentTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_Int__int = new global::TUnit.Core.TestMetadata { TestName = "Int", TestClassType = typeof(global::TUnit.TestProject.NumberArgumentTests), TestMethodName = "Int", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1), @@ -56,81 +56,17 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Int__int_TestSource Parent = null }) }, - InstanceFactory = TUnit_TestProject_NumberArgumentTests__ClassHelper.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.NumberArgumentTests.Int", - ClassName = "NumberArgumentTests", - MethodName = "Int", - FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.Int", - FilePath = @"", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Int__int, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NumberArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.Int(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_NumberArgumentTests_Double__double_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_Int__int.UseRuntimeDataGeneration(testSessionId); + var metadata_Double__double = new global::TUnit.Core.TestMetadata { TestName = "Double", TestClassType = typeof(global::TUnit.TestProject.NumberArgumentTests), TestMethodName = "Double", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1.1), @@ -171,81 +107,17 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Double__double_TestS Parent = null }) }, - InstanceFactory = TUnit_TestProject_NumberArgumentTests__ClassHelper.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.NumberArgumentTests.Double", - ClassName = "NumberArgumentTests", - MethodName = "Double", - FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.Double", - FilePath = @"", - LineNumber = 15, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Double__double, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NumberArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.Double(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_NumberArgumentTests_Float__float_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_Double__double.UseRuntimeDataGeneration(testSessionId); + var metadata_Float__float = new global::TUnit.Core.TestMetadata { TestName = "Float", TestClassType = typeof(global::TUnit.TestProject.NumberArgumentTests), TestMethodName = "Float", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1.1f), @@ -286,81 +158,17 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Float__float_TestSou Parent = null }) }, - InstanceFactory = TUnit_TestProject_NumberArgumentTests__ClassHelper.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.NumberArgumentTests.Float", - ClassName = "NumberArgumentTests", - MethodName = "Float", - FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.Float", - FilePath = @"", - LineNumber = 22, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Float__float, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NumberArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.Float(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_NumberArgumentTests_Long__long_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_Float__float.UseRuntimeDataGeneration(testSessionId); + var metadata_Long__long = new global::TUnit.Core.TestMetadata { TestName = "Long", TestClassType = typeof(global::TUnit.TestProject.NumberArgumentTests), TestMethodName = "Long", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1L), @@ -401,81 +209,17 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Long__long_TestSourc Parent = null }) }, - InstanceFactory = TUnit_TestProject_NumberArgumentTests__ClassHelper.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.NumberArgumentTests.Long", - ClassName = "NumberArgumentTests", - MethodName = "Long", - FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.Long", - FilePath = @"", - LineNumber = 29, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Long__long, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NumberArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.Long(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_NumberArgumentTests_ULong__ulong_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_Long__long.UseRuntimeDataGeneration(testSessionId); + var metadata_ULong__ulong = new global::TUnit.Core.TestMetadata { TestName = "ULong", TestClassType = typeof(global::TUnit.TestProject.NumberArgumentTests), TestMethodName = "ULong", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1UL), @@ -516,81 +260,17 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_ULong__ulong_TestSou Parent = null }) }, - InstanceFactory = TUnit_TestProject_NumberArgumentTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ULong__ulong, }; - 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.NumberArgumentTests.ULong", - ClassName = "NumberArgumentTests", - MethodName = "ULong", - FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.ULong", - FilePath = @"", - LineNumber = 36, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NumberArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.ULong(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_NumberArgumentTests_UInt__uint_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_ULong__ulong.UseRuntimeDataGeneration(testSessionId); + var metadata_UInt__uint = new global::TUnit.Core.TestMetadata { TestName = "UInt", TestClassType = typeof(global::TUnit.TestProject.NumberArgumentTests), TestMethodName = "UInt", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1U), @@ -631,14 +311,89 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_UInt__uint_TestSourc Parent = null }) }, - InstanceFactory = TUnit_TestProject_NumberArgumentTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_UInt__uint, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_UInt__uint.UseRuntimeDataGeneration(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 }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.NumberArgumentTests.Int", + ClassName = "NumberArgumentTests", + MethodName = "Int", + FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.Int", + FilePath = @"", + LineNumber = 8, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Int__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.NumberArgumentTests.Double", + ClassName = "NumberArgumentTests", + MethodName = "Double", + FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.Double", + FilePath = @"", + LineNumber = 15, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Double__double + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.NumberArgumentTests.Float", + ClassName = "NumberArgumentTests", + MethodName = "Float", + FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.Float", + FilePath = @"", + LineNumber = 22, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Float__float + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.NumberArgumentTests.Long", + ClassName = "NumberArgumentTests", + MethodName = "Long", + FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.Long", + FilePath = @"", + LineNumber = 29, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Long__long + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.NumberArgumentTests.ULong", + ClassName = "NumberArgumentTests", + MethodName = "ULong", + FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.ULong", + FilePath = @"", + LineNumber = 36, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_ULong__ulong + }; yield return new global::TUnit.Core.TestDescriptor { TestId = "TUnit.TestProject.NumberArgumentTests.UInt", @@ -652,10 +407,10 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_UInt__uint_TestSourc HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_UInt__uint }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -663,7 +418,107 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_UInt__uint_TestSourc new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NumberArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + 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 { @@ -683,20 +538,336 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_UInt__uint_TestSourc return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_NumberArgumentTests__ClassHelper -{ + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Int__int(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "Int", + TestClassType = typeof(global::TUnit.TestProject.NumberArgumentTests), + TestMethodName = "Int", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(1), + }, + 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 + { + Type = typeof(global::TUnit.TestProject.NumberArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NumberArgumentTests)), + Name = "Int", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "i", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Int", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Int__int, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Double__double(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "Double", + TestClassType = typeof(global::TUnit.TestProject.NumberArgumentTests), + TestMethodName = "Double", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 15, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.NumberArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NumberArgumentTests)), + Name = "Double", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(double)) + { + Name = "d", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(double)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Double", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(double) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Double__double, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Float__float(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "Float", + TestClassType = typeof(global::TUnit.TestProject.NumberArgumentTests), + TestMethodName = "Float", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(1.1f), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 22, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.NumberArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NumberArgumentTests)), + Name = "Float", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(float)) + { + Name = "f", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(float)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Float", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(float) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Float__float, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Long__long(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "Long", + TestClassType = typeof(global::TUnit.TestProject.NumberArgumentTests), + TestMethodName = "Long", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(1L), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 29, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.NumberArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NumberArgumentTests)), + Name = "Long", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(long)) + { + Name = "l", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(long)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Long", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(long) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Long__long, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_ULong__ulong(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "ULong", + TestClassType = typeof(global::TUnit.TestProject.NumberArgumentTests), + TestMethodName = "ULong", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(1UL), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 36, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.NumberArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NumberArgumentTests)), + Name = "ULong", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(ulong)) + { + Name = "l", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(ulong)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("ULong", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(ulong) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ULong__ulong, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_UInt__uint(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "UInt", + TestClassType = typeof(global::TUnit.TestProject.NumberArgumentTests), + TestMethodName = "UInt", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(1U), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 43, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.NumberArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NumberArgumentTests)), + Name = "UInt", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(uint)) + { + Name = "i", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(uint)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("UInt", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(uint) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_UInt__uint, + }; + metadata.UseRuntimeDataGeneration(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(); @@ -704,11 +875,6 @@ internal static class TUnit_TestProject_NumberArgumentTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.NumberArgumentTests), new TUnit_TestProject_NumberArgumentTests_Double__double_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.NumberArgumentTests), new TUnit_TestProject_NumberArgumentTests_Float__float_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.NumberArgumentTests), new TUnit_TestProject_NumberArgumentTests_Int__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.NumberArgumentTests), new TUnit_TestProject_NumberArgumentTests_Long__long_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.NumberArgumentTests), new TUnit_TestProject_NumberArgumentTests_UInt__uint_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.NumberArgumentTests), new TUnit_TestProject_NumberArgumentTests_ULong__ulong_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.NumberArgumentTests), new TUnit_TestProject_NumberArgumentTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.TestDE.verified.txt b/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.TestDE.verified.txt index 1e4b57de384..768e68be305 100644 --- a/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.TestDE.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/NumberArgumentTests.TestDE.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_NumberArgumentTests_Int__int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_NumberArgumentTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_Int__int = new global::TUnit.Core.TestMetadata { TestName = "Int", TestClassType = typeof(global::TUnit.TestProject.NumberArgumentTests), TestMethodName = "Int", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1), @@ -56,81 +56,17 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Int__int_TestSource Parent = null }) }, - InstanceFactory = TUnit_TestProject_NumberArgumentTests__ClassHelper.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.NumberArgumentTests.Int", - ClassName = "NumberArgumentTests", - MethodName = "Int", - FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.Int", - FilePath = @"", - LineNumber = 8, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Int__int, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NumberArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.Int(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_NumberArgumentTests_Double__double_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_Int__int.UseRuntimeDataGeneration(testSessionId); + var metadata_Double__double = new global::TUnit.Core.TestMetadata { TestName = "Double", TestClassType = typeof(global::TUnit.TestProject.NumberArgumentTests), TestMethodName = "Double", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1.1), @@ -171,81 +107,17 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Double__double_TestS Parent = null }) }, - InstanceFactory = TUnit_TestProject_NumberArgumentTests__ClassHelper.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.NumberArgumentTests.Double", - ClassName = "NumberArgumentTests", - MethodName = "Double", - FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.Double", - FilePath = @"", - LineNumber = 15, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Double__double, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NumberArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.Double(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_NumberArgumentTests_Float__float_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_Double__double.UseRuntimeDataGeneration(testSessionId); + var metadata_Float__float = new global::TUnit.Core.TestMetadata { TestName = "Float", TestClassType = typeof(global::TUnit.TestProject.NumberArgumentTests), TestMethodName = "Float", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1.1f), @@ -286,81 +158,17 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Float__float_TestSou Parent = null }) }, - InstanceFactory = TUnit_TestProject_NumberArgumentTests__ClassHelper.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.NumberArgumentTests.Float", - ClassName = "NumberArgumentTests", - MethodName = "Float", - FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.Float", - FilePath = @"", - LineNumber = 22, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Float__float, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NumberArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.Float(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_NumberArgumentTests_Long__long_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_Float__float.UseRuntimeDataGeneration(testSessionId); + var metadata_Long__long = new global::TUnit.Core.TestMetadata { TestName = "Long", TestClassType = typeof(global::TUnit.TestProject.NumberArgumentTests), TestMethodName = "Long", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1L), @@ -401,81 +209,17 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_Long__long_TestSourc Parent = null }) }, - InstanceFactory = TUnit_TestProject_NumberArgumentTests__ClassHelper.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.NumberArgumentTests.Long", - ClassName = "NumberArgumentTests", - MethodName = "Long", - FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.Long", - FilePath = @"", - LineNumber = 29, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Long__long, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NumberArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.Long(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_NumberArgumentTests_ULong__ulong_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_Long__long.UseRuntimeDataGeneration(testSessionId); + var metadata_ULong__ulong = new global::TUnit.Core.TestMetadata { TestName = "ULong", TestClassType = typeof(global::TUnit.TestProject.NumberArgumentTests), TestMethodName = "ULong", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1UL), @@ -516,81 +260,17 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_ULong__ulong_TestSou Parent = null }) }, - InstanceFactory = TUnit_TestProject_NumberArgumentTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ULong__ulong, }; - 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.NumberArgumentTests.ULong", - ClassName = "NumberArgumentTests", - MethodName = "ULong", - FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.ULong", - FilePath = @"", - LineNumber = 36, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NumberArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - instance.ULong(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_NumberArgumentTests_UInt__uint_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_ULong__ulong.UseRuntimeDataGeneration(testSessionId); + var metadata_UInt__uint = new global::TUnit.Core.TestMetadata { TestName = "UInt", TestClassType = typeof(global::TUnit.TestProject.NumberArgumentTests), TestMethodName = "UInt", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1U), @@ -631,14 +311,89 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_UInt__uint_TestSourc Parent = null }) }, - InstanceFactory = TUnit_TestProject_NumberArgumentTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_UInt__uint, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_UInt__uint.UseRuntimeDataGeneration(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 }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.NumberArgumentTests.Int", + ClassName = "NumberArgumentTests", + MethodName = "Int", + FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.Int", + FilePath = @"", + LineNumber = 8, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Int__int + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.NumberArgumentTests.Double", + ClassName = "NumberArgumentTests", + MethodName = "Double", + FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.Double", + FilePath = @"", + LineNumber = 15, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Double__double + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.NumberArgumentTests.Float", + ClassName = "NumberArgumentTests", + MethodName = "Float", + FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.Float", + FilePath = @"", + LineNumber = 22, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Float__float + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.NumberArgumentTests.Long", + ClassName = "NumberArgumentTests", + MethodName = "Long", + FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.Long", + FilePath = @"", + LineNumber = 29, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Long__long + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.NumberArgumentTests.ULong", + ClassName = "NumberArgumentTests", + MethodName = "ULong", + FullyQualifiedName = "TUnit.TestProject.NumberArgumentTests.ULong", + FilePath = @"", + LineNumber = 36, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_ULong__ulong + }; yield return new global::TUnit.Core.TestDescriptor { TestId = "TUnit.TestProject.NumberArgumentTests.UInt", @@ -652,10 +407,10 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_UInt__uint_TestSourc HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_UInt__uint }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -663,7 +418,107 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_UInt__uint_TestSourc new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.NumberArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + 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 { @@ -683,20 +538,336 @@ internal sealed class TUnit_TestProject_NumberArgumentTests_UInt__uint_TestSourc return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_NumberArgumentTests__ClassHelper -{ + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Int__int(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "Int", + TestClassType = typeof(global::TUnit.TestProject.NumberArgumentTests), + TestMethodName = "Int", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(1), + }, + 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 + { + Type = typeof(global::TUnit.TestProject.NumberArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NumberArgumentTests)), + Name = "Int", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "i", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Int", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Int__int, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Double__double(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "Double", + TestClassType = typeof(global::TUnit.TestProject.NumberArgumentTests), + TestMethodName = "Double", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 15, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.NumberArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NumberArgumentTests)), + Name = "Double", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(double)) + { + Name = "d", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(double)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Double", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(double) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Double__double, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Float__float(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "Float", + TestClassType = typeof(global::TUnit.TestProject.NumberArgumentTests), + TestMethodName = "Float", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(1.1f), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 22, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.NumberArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NumberArgumentTests)), + Name = "Float", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(float)) + { + Name = "f", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(float)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Float", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(float) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Float__float, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Long__long(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "Long", + TestClassType = typeof(global::TUnit.TestProject.NumberArgumentTests), + TestMethodName = "Long", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(1L), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 29, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.NumberArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NumberArgumentTests)), + Name = "Long", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(long)) + { + Name = "l", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(long)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("Long", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(long) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Long__long, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_ULong__ulong(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "ULong", + TestClassType = typeof(global::TUnit.TestProject.NumberArgumentTests), + TestMethodName = "ULong", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(1UL), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 36, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.NumberArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NumberArgumentTests)), + Name = "ULong", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(ulong)) + { + Name = "l", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(ulong)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("ULong", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(ulong) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_ULong__ulong, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_UInt__uint(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "UInt", + TestClassType = typeof(global::TUnit.TestProject.NumberArgumentTests), + TestMethodName = "UInt", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(1U), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 43, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.NumberArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.NumberArgumentTests)), + Name = "UInt", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(uint)) + { + Name = "i", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(uint)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.NumberArgumentTests).GetMethod("UInt", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(uint) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.NumberArgumentTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_UInt__uint, + }; + metadata.UseRuntimeDataGeneration(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(); @@ -704,11 +875,6 @@ internal static class TUnit_TestProject_NumberArgumentTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.NumberArgumentTests), new TUnit_TestProject_NumberArgumentTests_Double__double_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.NumberArgumentTests), new TUnit_TestProject_NumberArgumentTests_Float__float_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.NumberArgumentTests), new TUnit_TestProject_NumberArgumentTests_Int__int_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.NumberArgumentTests), new TUnit_TestProject_NumberArgumentTests_Long__long_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.NumberArgumentTests), new TUnit_TestProject_NumberArgumentTests_UInt__uint_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.NumberArgumentTests), new TUnit_TestProject_NumberArgumentTests_ULong__ulong_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.NumberArgumentTests), new TUnit_TestProject_NumberArgumentTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/PriorityFilteringTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/PriorityFilteringTests.Test.verified.txt index 5f504318c86..7875800c9c4 100644 --- a/TUnit.Core.SourceGenerator.Tests/PriorityFilteringTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/PriorityFilteringTests.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_PriorityFilteringTests_High_1_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_PriorityFilteringTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_High_1 = new global::TUnit.Core.TestMetadata { TestName = "High_1", TestClassType = typeof(global::TUnit.TestProject.PriorityFilteringTests), TestMethodName = "High_1", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -44,11 +44,206 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_High_1_TestSource Parent = null }) }, - InstanceFactory = TUnit_TestProject_PriorityFilteringTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_High_1, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_High_1.UseRuntimeDataGeneration(testSessionId); + var metadata_High_2 = new global::TUnit.Core.TestMetadata + { + TestName = "High_2", + TestClassType = typeof(global::TUnit.TestProject.PriorityFilteringTests), + TestMethodName = "High_2", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 18, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.PriorityFilteringTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.PriorityFilteringTests)), + Name = "High_2", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_High_2, + }; + metadata_High_2.UseRuntimeDataGeneration(testSessionId); + var metadata_High_3 = new global::TUnit.Core.TestMetadata + { + TestName = "High_3", + TestClassType = typeof(global::TUnit.TestProject.PriorityFilteringTests), + TestMethodName = "High_3", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 24, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.PriorityFilteringTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.PriorityFilteringTests)), + Name = "High_3", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_High_3, + }; + metadata_High_3.UseRuntimeDataGeneration(testSessionId); + var metadata_Medium_1 = new global::TUnit.Core.TestMetadata + { + TestName = "Medium_1", + TestClassType = typeof(global::TUnit.TestProject.PriorityFilteringTests), + TestMethodName = "Medium_1", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_1, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 30, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.PriorityFilteringTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.PriorityFilteringTests)), + Name = "Medium_1", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Medium_1, + }; + metadata_Medium_1.UseRuntimeDataGeneration(testSessionId); + var metadata_Medium_2 = new global::TUnit.Core.TestMetadata + { + TestName = "Medium_2", + TestClassType = typeof(global::TUnit.TestProject.PriorityFilteringTests), + TestMethodName = "Medium_2", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_1, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 36, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.PriorityFilteringTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.PriorityFilteringTests)), + Name = "Medium_2", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Medium_2, + }; + metadata_Medium_2.UseRuntimeDataGeneration(testSessionId); + var metadata_Low_1 = new global::TUnit.Core.TestMetadata + { + TestName = "Low_1", + TestClassType = typeof(global::TUnit.TestProject.PriorityFilteringTests), + TestMethodName = "Low_1", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_2, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 42, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.PriorityFilteringTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.PriorityFilteringTests)), + Name = "Low_1", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Low_1, + }; + metadata_Low_1.UseRuntimeDataGeneration(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 }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -65,10 +260,85 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_High_1_TestSource HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_High_1 + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.PriorityFilteringTests.High_2", + ClassName = "PriorityFilteringTests", + MethodName = "High_2", + FullyQualifiedName = "TUnit.TestProject.PriorityFilteringTests.High_2", + FilePath = @"", + LineNumber = 18, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_High_2 + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.PriorityFilteringTests.High_3", + ClassName = "PriorityFilteringTests", + MethodName = "High_3", + FullyQualifiedName = "TUnit.TestProject.PriorityFilteringTests.High_3", + FilePath = @"", + LineNumber = 24, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_High_3 + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.PriorityFilteringTests.Medium_1", + ClassName = "PriorityFilteringTests", + MethodName = "Medium_1", + FullyQualifiedName = "TUnit.TestProject.PriorityFilteringTests.Medium_1", + FilePath = @"", + LineNumber = 30, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Medium_1 + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.PriorityFilteringTests.Medium_2", + ClassName = "PriorityFilteringTests", + MethodName = "Medium_2", + FullyQualifiedName = "TUnit.TestProject.PriorityFilteringTests.Medium_2", + FilePath = @"", + LineNumber = 36, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Medium_2 + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.PriorityFilteringTests.Low_1", + ClassName = "PriorityFilteringTests", + MethodName = "Low_1", + FullyQualifiedName = "TUnit.TestProject.PriorityFilteringTests.Low_1", + FilePath = @"", + LineNumber = 42, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Low_1 }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -76,7 +346,23 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_High_1_TestSource new global::TUnit.TestProject.PriorityAttribute(global::TUnit.TestProject.Enums.PriorityLevel.High) ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.PriorityFilteringTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + 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 { @@ -87,21 +373,105 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_High_1_TestSource return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_PriorityFilteringTests_High_2_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata + { + TestName = "High_1", + TestClassType = typeof(global::TUnit.TestProject.PriorityFilteringTests), + TestMethodName = "High_1", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 12, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.PriorityFilteringTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.PriorityFilteringTests)), + Name = "High_1", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_High_1, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_High_2(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -109,7 +479,7 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_High_2_TestSource TestClassType = typeof(global::TUnit.TestProject.PriorityFilteringTests), TestMethodName = "High_2", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -138,64 +508,13 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_High_2_TestSource Parent = null }) }, - InstanceFactory = TUnit_TestProject_PriorityFilteringTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_High_2, }; 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.PriorityFilteringTests.High_2", - ClassName = "PriorityFilteringTests", - MethodName = "High_2", - FullyQualifiedName = "TUnit.TestProject.PriorityFilteringTests.High_2", - FilePath = @"", - LineNumber = 18, - 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.PriorityAttribute(global::TUnit.TestProject.Enums.PriorityLevel.High) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.PriorityFilteringTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.High_2()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_PriorityFilteringTests_High_3_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_High_3(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -203,7 +522,7 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_High_3_TestSource TestClassType = typeof(global::TUnit.TestProject.PriorityFilteringTests), TestMethodName = "High_3", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -232,64 +551,13 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_High_3_TestSource Parent = null }) }, - InstanceFactory = TUnit_TestProject_PriorityFilteringTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_High_3, }; 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.PriorityFilteringTests.High_3", - ClassName = "PriorityFilteringTests", - MethodName = "High_3", - FullyQualifiedName = "TUnit.TestProject.PriorityFilteringTests.High_3", - FilePath = @"", - LineNumber = 24, - 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.PriorityAttribute(global::TUnit.TestProject.Enums.PriorityLevel.High) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.PriorityFilteringTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.High_3()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_PriorityFilteringTests_Medium_1_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Medium_1(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -297,7 +565,7 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_Medium_1_TestSour TestClassType = typeof(global::TUnit.TestProject.PriorityFilteringTests), TestMethodName = "Medium_1", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_1, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -326,64 +594,13 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_Medium_1_TestSour Parent = null }) }, - InstanceFactory = TUnit_TestProject_PriorityFilteringTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Medium_1, }; 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.PriorityFilteringTests.Medium_1", - ClassName = "PriorityFilteringTests", - MethodName = "Medium_1", - FullyQualifiedName = "TUnit.TestProject.PriorityFilteringTests.Medium_1", - FilePath = @"", - LineNumber = 30, - 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.PriorityAttribute(global::TUnit.TestProject.Enums.PriorityLevel.Medium) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.PriorityFilteringTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.Medium_1()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_PriorityFilteringTests_Medium_2_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Medium_2(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -391,7 +608,7 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_Medium_2_TestSour TestClassType = typeof(global::TUnit.TestProject.PriorityFilteringTests), TestMethodName = "Medium_2", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_1, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -420,64 +637,13 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_Medium_2_TestSour Parent = null }) }, - InstanceFactory = TUnit_TestProject_PriorityFilteringTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Medium_2, }; 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.PriorityFilteringTests.Medium_2", - ClassName = "PriorityFilteringTests", - MethodName = "Medium_2", - FullyQualifiedName = "TUnit.TestProject.PriorityFilteringTests.Medium_2", - FilePath = @"", - LineNumber = 36, - 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.PriorityAttribute(global::TUnit.TestProject.Enums.PriorityLevel.Medium) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.PriorityFilteringTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.Medium_2()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_PriorityFilteringTests_Low_1_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Low_1(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -485,7 +651,7 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_Low_1_TestSource TestClassType = typeof(global::TUnit.TestProject.PriorityFilteringTests), TestMethodName = "Low_1", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_2, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -514,63 +680,12 @@ internal sealed class TUnit_TestProject_PriorityFilteringTests_Low_1_TestSource Parent = null }) }, - InstanceFactory = TUnit_TestProject_PriorityFilteringTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Low_1, }; 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.PriorityFilteringTests.Low_1", - ClassName = "PriorityFilteringTests", - MethodName = "Low_1", - FullyQualifiedName = "TUnit.TestProject.PriorityFilteringTests.Low_1", - FilePath = @"", - LineNumber = 42, - 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.PriorityAttribute(global::TUnit.TestProject.Enums.PriorityLevel.Low) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.PriorityFilteringTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.Low_1()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_PriorityFilteringTests__ClassHelper -{ internal static global::TUnit.TestProject.PriorityFilteringTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.PriorityFilteringTests(); @@ -578,11 +693,6 @@ internal static class TUnit_TestProject_PriorityFilteringTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.PriorityFilteringTests), new TUnit_TestProject_PriorityFilteringTests_High_1_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.PriorityFilteringTests), new TUnit_TestProject_PriorityFilteringTests_High_2_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.PriorityFilteringTests), new TUnit_TestProject_PriorityFilteringTests_High_3_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.PriorityFilteringTests), new TUnit_TestProject_PriorityFilteringTests_Low_1_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.PriorityFilteringTests), new TUnit_TestProject_PriorityFilteringTests_Medium_1_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.PriorityFilteringTests), new TUnit_TestProject_PriorityFilteringTests_Medium_2_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.PriorityFilteringTests), new TUnit_TestProject_PriorityFilteringTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/PropertySetterTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/PropertySetterTests.Test.verified.txt index e4d22318b00..ee04a7c3ffc 100644 --- a/TUnit.Core.SourceGenerator.Tests/PropertySetterTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/PropertySetterTests.Test.verified.txt @@ -5,7 +5,7 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_PropertySetterTests_Test_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_PropertySetterTests__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")] @@ -23,13 +23,13 @@ internal sealed class TUnit_TestProject_PropertySetterTests_Test_TestSource : gl #endif public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_Test = new global::TUnit.Core.TestMetadata { TestName = "Test", TestClassType = typeof(global::TUnit.TestProject.PropertySetterTests), TestMethodName = "Test", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = new global::TUnit.Core.PropertyDataSource[] @@ -62,21 +62,21 @@ internal sealed class TUnit_TestProject_PropertySetterTests_Test_TestSource : gl PropertyName = "Property4", PropertyType = typeof(global::TUnit.TestProject.PropertySetterTests.InnerModel), DataSource = new global::TUnit.Core.ClassDataSourceAttribute() -{Shared = global::TUnit.Core.SharedType.PerTestSession,}, + {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,}, + {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",}, + {Shared = global::TUnit.Core.SharedType.Keyed,Key = "Key",}, }, new global::TUnit.Core.PropertyDataSource { @@ -298,11 +298,11 @@ internal sealed class TUnit_TestProject_PropertySetterTests_Test_TestSource : gl Parent = null }) }, - InstanceFactory = TUnit_TestProject_PropertySetterTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_Test.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_Test }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -319,10 +319,10 @@ internal sealed class TUnit_TestProject_PropertySetterTests_Test_TestSource : gl HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_Test }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -331,7 +331,7 @@ internal sealed class TUnit_TestProject_PropertySetterTests_Test_TestSource : gl new global::TUnit.Core.NotInParallelAttribute("PropertySetterTests") ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.PropertySetterTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_Test(global::TUnit.TestProject.PropertySetterTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -342,20 +342,289 @@ internal sealed class TUnit_TestProject_PropertySetterTests_Test_TestSource : gl return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_PropertySetterTests__ClassHelper -{ + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "Test", + TestClassType = typeof(global::TUnit.TestProject.PropertySetterTests), + TestMethodName = "Test", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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") + { + 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(); + } + }, + 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 = 0, + FilePath = @"", + LineNumber = 69, + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test, + }; + metadata.UseRuntimeDataGeneration(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() @@ -372,6 +641,6 @@ internal static class TUnit_TestProject_PropertySetterTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.PropertySetterTests), new TUnit_TestProject_PropertySetterTests_Test_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.PropertySetterTests), new TUnit_TestProject_PropertySetterTests__TestSource()); } } 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 eda4462541c..8364d0f4356 100644 --- a/TUnit.Core.SourceGenerator.Tests/RepeatTests.Assembly_Level_Repeat.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/RepeatTests.Assembly_Level_Repeat.verified.txt @@ -5,18 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_AssemblyRepeatTests_TestWithAssemblyRepeat_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_AssemblyRepeatTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_TestWithAssemblyRepeat = new global::TUnit.Core.TestMetadata { TestName = "TestWithAssemblyRepeat", TestClassType = typeof(global::TUnit.TestProject.AssemblyRepeatTests), TestMethodName = "TestWithAssemblyRepeat", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 3, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -45,11 +44,52 @@ internal sealed class TUnit_TestProject_AssemblyRepeatTests_TestWithAssemblyRepe Parent = null }) }, - InstanceFactory = TUnit_TestProject_AssemblyRepeatTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_TestWithAssemblyRepeat, + RepeatCount = 3, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_TestWithAssemblyRepeat.UseRuntimeDataGeneration(testSessionId); + var metadata_TestWithMethodRepeatOverride = new global::TUnit.Core.TestMetadata + { + TestName = "TestWithMethodRepeatOverride", + TestClassType = typeof(global::TUnit.TestProject.AssemblyRepeatTests), + TestMethodName = "TestWithMethodRepeatOverride", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_1, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 14, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.AssemblyRepeatTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AssemblyRepeatTests)), + Name = "TestWithMethodRepeatOverride", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_TestWithMethodRepeatOverride, + RepeatCount = 1, + }; + metadata_TestWithMethodRepeatOverride.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_TestWithAssemblyRepeat, metadata_TestWithMethodRepeatOverride }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -66,10 +106,25 @@ internal sealed class TUnit_TestProject_AssemblyRepeatTests_TestWithAssemblyRepe HasDataSource = false, RepeatCount = 3, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_TestWithAssemblyRepeat + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.AssemblyRepeatTests.TestWithMethodRepeatOverride", + ClassName = "AssemblyRepeatTests", + MethodName = "TestWithMethodRepeatOverride", + FullyQualifiedName = "TUnit.TestProject.AssemblyRepeatTests.TestWithMethodRepeatOverride", + FilePath = @"", + LineNumber = 14, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 1, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_TestWithMethodRepeatOverride }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -77,7 +132,16 @@ internal sealed class TUnit_TestProject_AssemblyRepeatTests_TestWithAssemblyRepe new global::TUnit.Core.RepeatAttribute(3) ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AssemblyRepeatTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + 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 { @@ -89,42 +153,39 @@ internal sealed class TUnit_TestProject_AssemblyRepeatTests_TestWithAssemblyRepe return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_AssemblyRepeatTests_TestWithMethodRepeatOverride_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata { - TestName = "TestWithMethodRepeatOverride", + TestName = "TestWithAssemblyRepeat", TestClassType = typeof(global::TUnit.TestProject.AssemblyRepeatTests), - TestMethodName = "TestWithMethodRepeatOverride", + TestMethodName = "TestWithAssemblyRepeat", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 1, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 14, + LineNumber = 9, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.AssemblyRepeatTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AssemblyRepeatTests)), - Name = "TestWithMethodRepeatOverride", + Name = "TestWithAssemblyRepeat", GenericTypeCount = 0, ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), @@ -141,65 +202,57 @@ internal sealed class TUnit_TestProject_AssemblyRepeatTests_TestWithMethodRepeat Parent = null }) }, - InstanceFactory = TUnit_TestProject_AssemblyRepeatTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_TestWithAssemblyRepeat, + RepeatCount = 3, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_TestWithMethodRepeatOverride(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.AssemblyRepeatTests.TestWithMethodRepeatOverride", - ClassName = "AssemblyRepeatTests", - MethodName = "TestWithMethodRepeatOverride", - FullyQualifiedName = "TUnit.TestProject.AssemblyRepeatTests.TestWithMethodRepeatOverride", + TestName = "TestWithMethodRepeatOverride", + TestClassType = typeof(global::TUnit.TestProject.AssemblyRepeatTests), + TestMethodName = "TestWithMethodRepeatOverride", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_1, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", LineNumber = 14, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.AssemblyRepeatTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AssemblyRepeatTests)), + Name = "TestWithMethodRepeatOverride", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_TestWithMethodRepeatOverride, RepeatCount = 1, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.RepeatAttribute(1), - new global::TUnit.Core.RepeatAttribute(3) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AssemblyRepeatTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - instance.TestWithMethodRepeatOverride(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_AssemblyRepeatTests__ClassHelper -{ internal static global::TUnit.TestProject.AssemblyRepeatTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.AssemblyRepeatTests(); @@ -207,7 +260,6 @@ internal static class TUnit_TestProject_AssemblyRepeatTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AssemblyRepeatTests), new TUnit_TestProject_AssemblyRepeatTests_TestWithAssemblyRepeat_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AssemblyRepeatTests), new TUnit_TestProject_AssemblyRepeatTests_TestWithMethodRepeatOverride_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AssemblyRepeatTests), new TUnit_TestProject_AssemblyRepeatTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/RepeatTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/RepeatTests.Test.verified.txt index 9dba65cfa38..31090dc0fe5 100644 --- a/TUnit.Core.SourceGenerator.Tests/RepeatTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/RepeatTests.Test.verified.txt @@ -5,18 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_RepeatTests_One_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_RepeatTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_One = new global::TUnit.Core.TestMetadata { TestName = "One", TestClassType = typeof(global::TUnit.TestProject.RepeatTests), TestMethodName = "One", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 1, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -45,11 +44,92 @@ internal sealed class TUnit_TestProject_RepeatTests_One_TestSource : global::TUn Parent = null }) }, - InstanceFactory = TUnit_TestProject_RepeatTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_One, + RepeatCount = 1, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_One.UseRuntimeDataGeneration(testSessionId); + var metadata_Two = new global::TUnit.Core.TestMetadata + { + TestName = "Two", + TestClassType = typeof(global::TUnit.TestProject.RepeatTests), + TestMethodName = "Two", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_1, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 16, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.RepeatTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.RepeatTests)), + Name = "Two", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Two, + RepeatCount = 2, + }; + metadata_Two.UseRuntimeDataGeneration(testSessionId); + var metadata_Three = new global::TUnit.Core.TestMetadata + { + TestName = "Three", + TestClassType = typeof(global::TUnit.TestProject.RepeatTests), + TestMethodName = "Three", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_2, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 23, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.RepeatTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.RepeatTests)), + Name = "Three", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Three, + RepeatCount = 3, + }; + metadata_Three.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_One, metadata_Two, metadata_Three }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -66,10 +146,40 @@ internal sealed class TUnit_TestProject_RepeatTests_One_TestSource : global::TUn HasDataSource = false, RepeatCount = 1, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_One + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.RepeatTests.Two", + ClassName = "RepeatTests", + MethodName = "Two", + FullyQualifiedName = "TUnit.TestProject.RepeatTests.Two", + FilePath = @"", + LineNumber = 16, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 2, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Two + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.RepeatTests.Three", + ClassName = "RepeatTests", + MethodName = "Three", + FullyQualifiedName = "TUnit.TestProject.RepeatTests.Three", + FilePath = @"", + LineNumber = 23, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 3, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Three }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -79,7 +189,26 @@ internal sealed class TUnit_TestProject_RepeatTests_One_TestSource : global::TUn new global::TUnit.Core.RepeatAttribute(3) ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.RepeatTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + 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 { @@ -91,42 +220,51 @@ internal sealed class TUnit_TestProject_RepeatTests_One_TestSource : global::TUn return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_RepeatTests_Two_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata { - TestName = "Two", + TestName = "One", TestClassType = typeof(global::TUnit.TestProject.RepeatTests), - TestMethodName = "Two", + TestMethodName = "One", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 2, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 16, + LineNumber = 9, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.RepeatTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.RepeatTests)), - Name = "Two", + Name = "One", GenericTypeCount = 0, ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), @@ -143,67 +281,58 @@ internal sealed class TUnit_TestProject_RepeatTests_Two_TestSource : global::TUn Parent = null }) }, - InstanceFactory = TUnit_TestProject_RepeatTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_One, + RepeatCount = 1, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Two(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.RepeatTests.Two", - ClassName = "RepeatTests", - MethodName = "Two", - FullyQualifiedName = "TUnit.TestProject.RepeatTests.Two", + TestName = "Two", + TestClassType = typeof(global::TUnit.TestProject.RepeatTests), + TestMethodName = "Two", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_1, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", LineNumber = 16, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.RepeatTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.RepeatTests)), + Name = "Two", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Two, RepeatCount = 2, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.RepeatAttribute(2), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RepeatAttribute(3) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.RepeatTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - instance.Two(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_RepeatTests_Three_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Three(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -211,8 +340,7 @@ internal sealed class TUnit_TestProject_RepeatTests_Three_TestSource : global::T TestClassType = typeof(global::TUnit.TestProject.RepeatTests), TestMethodName = "Three", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 3, + AttributeFactory = __CreateAttributes_2, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -241,65 +369,13 @@ internal sealed class TUnit_TestProject_RepeatTests_Three_TestSource : global::T Parent = null }) }, - InstanceFactory = TUnit_TestProject_RepeatTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Three, + RepeatCount = 3, }; 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.RepeatTests.Three", - ClassName = "RepeatTests", - MethodName = "Three", - FullyQualifiedName = "TUnit.TestProject.RepeatTests.Three", - FilePath = @"", - LineNumber = 23, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 3, - 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.RepeatAttribute(3) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.RepeatTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - instance.Three(); - return default(global::System.Threading.Tasks.ValueTask); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_RepeatTests__ClassHelper -{ internal static global::TUnit.TestProject.RepeatTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.RepeatTests(); @@ -307,8 +383,6 @@ internal static class TUnit_TestProject_RepeatTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.RepeatTests), new TUnit_TestProject_RepeatTests_One_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.RepeatTests), new TUnit_TestProject_RepeatTests_Three_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.RepeatTests), new TUnit_TestProject_RepeatTests_Two_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.RepeatTests), new TUnit_TestProject_RepeatTests__TestSource()); } } 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 d6c68daf731..bea60945c07 100644 --- a/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet10_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet10_0.verified.txt @@ -5,18 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_With_STA_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_STAThreadTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_With_STA = new global::TUnit.Core.TestMetadata { TestName = "With_STA", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "With_STA", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -45,77 +44,18 @@ internal sealed class TUnit_TestProject_STAThreadTests_With_STA_TestSource : glo Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.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.STAThreadTests.With_STA", - ClassName = "STAThreadTests", - MethodName = "With_STA", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.With_STA", - FilePath = @"", - LineNumber = 14, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_With_STA, RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.With_STA()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_Without_STA_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_With_STA.UseRuntimeDataGeneration(testSessionId); + var metadata_Without_STA = new global::TUnit.Core.TestMetadata { TestName = "Without_STA", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "Without_STA", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_1, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -144,76 +84,18 @@ internal sealed class TUnit_TestProject_STAThreadTests_Without_STA_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.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.STAThreadTests.Without_STA", - ClassName = "STAThreadTests", - MethodName = "Without_STA", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.Without_STA", - FilePath = @"", - LineNumber = 20, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Without_STA, RepeatCount = 100, - 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.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(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)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_Without_STA.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithSimpleAwait = new global::TUnit.Core.TestMetadata { TestName = "STA_WithSimpleAwait", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithSimpleAwait", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -242,77 +124,18 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_TestS Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.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.STAThreadTests.STA_WithSimpleAwait", - ClassName = "STAThreadTests", - MethodName = "STA_WithSimpleAwait", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithSimpleAwait", - FilePath = @"", - LineNumber = 26, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithSimpleAwait, RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithSimpleAwait()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskYield_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_STA_WithSimpleAwait.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithTaskYield = new global::TUnit.Core.TestMetadata { TestName = "STA_WithTaskYield", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithTaskYield", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -341,77 +164,18 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskYield_TestSou Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.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.STAThreadTests.STA_WithTaskYield", - ClassName = "STAThreadTests", - MethodName = "STA_WithTaskYield", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskYield", - FilePath = @"", - LineNumber = 36, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithTaskYield, RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskYield()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTrue_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_STA_WithTaskYield.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithConfigureAwaitTrue = new global::TUnit.Core.TestMetadata { TestName = "STA_WithConfigureAwaitTrue", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithConfigureAwaitTrue", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -440,34 +204,645 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTru Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithConfigureAwaitTrue, + RepeatCount = 100, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor + metadata_STA_WithConfigureAwaitTrue.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithNestedAsyncCalls = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithConfigureAwaitTrue", - ClassName = "STAThreadTests", - MethodName = "STA_WithConfigureAwaitTrue", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithConfigureAwaitTrue", + TestName = "STA_WithNestedAsyncCalls", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithNestedAsyncCalls", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", - LineNumber = 45, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ + LineNumber = 54, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithNestedAsyncCalls", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithNestedAsyncCalls, + RepeatCount = 100, + }; + metadata_STA_WithNestedAsyncCalls.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithTaskFromResult = new global::TUnit.Core.TestMetadata + { + TestName = "STA_WithTaskFromResult", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithTaskFromResult", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 64, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithTaskFromResult", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithTaskFromResult, + RepeatCount = 100, + }; + metadata_STA_WithTaskFromResult.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithCompletedTask = new global::TUnit.Core.TestMetadata + { + TestName = "STA_WithCompletedTask", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithCompletedTask", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithCompletedTask", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithCompletedTask, + RepeatCount = 100, + }; + metadata_STA_WithCompletedTask.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithTaskRun = new global::TUnit.Core.TestMetadata + { + TestName = "STA_WithTaskRun", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithTaskRun", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 83, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithTaskRun", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithTaskRun, + RepeatCount = 100, + }; + metadata_STA_WithTaskRun.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithMultipleAwaits = new global::TUnit.Core.TestMetadata + { + TestName = "STA_WithMultipleAwaits", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithMultipleAwaits", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 98, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithMultipleAwaits", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithMultipleAwaits, + RepeatCount = 100, + }; + metadata_STA_WithMultipleAwaits.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithAsyncEnumerable = new global::TUnit.Core.TestMetadata + { + TestName = "STA_WithAsyncEnumerable", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithAsyncEnumerable", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 116, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithAsyncEnumerable", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithAsyncEnumerable, + RepeatCount = 100, + }; + metadata_STA_WithAsyncEnumerable.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithTaskWhenAll = new global::TUnit.Core.TestMetadata + { + TestName = "STA_WithTaskWhenAll", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithTaskWhenAll", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 130, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithTaskWhenAll", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithTaskWhenAll, + RepeatCount = 100, + }; + metadata_STA_WithTaskWhenAll.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithExceptionHandling = new global::TUnit.Core.TestMetadata + { + TestName = "STA_WithExceptionHandling", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithExceptionHandling", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 147, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithExceptionHandling", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithExceptionHandling, + RepeatCount = 100, + }; + metadata_STA_WithExceptionHandling.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithThrowsNothingAssertion = new global::TUnit.Core.TestMetadata + { + TestName = "STA_WithThrowsNothingAssertion", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithThrowsNothingAssertion", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 194, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithThrowsNothingAssertion", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithThrowsNothingAssertion, + RepeatCount = 100, + }; + metadata_STA_WithThrowsNothingAssertion.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithFuncAssertion = new global::TUnit.Core.TestMetadata + { + TestName = "STA_WithFuncAssertion", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithFuncAssertion", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 211, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithFuncAssertion", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithFuncAssertion, + RepeatCount = 100, + }; + metadata_STA_WithFuncAssertion.UseRuntimeDataGeneration(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 }; + } + public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + { + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.With_STA", + ClassName = "STAThreadTests", + MethodName = "With_STA", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.With_STA", + FilePath = @"", + LineNumber = 14, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_With_STA + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.Without_STA", + ClassName = "STAThreadTests", + MethodName = "Without_STA", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.Without_STA", + FilePath = @"", + LineNumber = 20, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Without_STA + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithSimpleAwait", + ClassName = "STAThreadTests", + MethodName = "STA_WithSimpleAwait", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithSimpleAwait", + FilePath = @"", + LineNumber = 26, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithSimpleAwait + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithTaskYield", + ClassName = "STAThreadTests", + MethodName = "STA_WithTaskYield", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskYield", + FilePath = @"", + LineNumber = 36, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithTaskYield + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithConfigureAwaitTrue", + ClassName = "STAThreadTests", + MethodName = "STA_WithConfigureAwaitTrue", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithConfigureAwaitTrue", + FilePath = @"", + LineNumber = 45, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithConfigureAwaitTrue + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithNestedAsyncCalls", + ClassName = "STAThreadTests", + MethodName = "STA_WithNestedAsyncCalls", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithNestedAsyncCalls", + FilePath = @"", + LineNumber = 54, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithNestedAsyncCalls + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithTaskFromResult", + ClassName = "STAThreadTests", + MethodName = "STA_WithTaskFromResult", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskFromResult", + FilePath = @"", + LineNumber = 64, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithTaskFromResult + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithCompletedTask", + ClassName = "STAThreadTests", + MethodName = "STA_WithCompletedTask", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithCompletedTask", + FilePath = @"", + LineNumber = 74, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithCompletedTask + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithTaskRun", + ClassName = "STAThreadTests", + MethodName = "STA_WithTaskRun", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskRun", + FilePath = @"", + LineNumber = 83, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithTaskRun + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithMultipleAwaits", + ClassName = "STAThreadTests", + MethodName = "STA_WithMultipleAwaits", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithMultipleAwaits", + FilePath = @"", + LineNumber = 98, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithMultipleAwaits + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithAsyncEnumerable", + ClassName = "STAThreadTests", + MethodName = "STA_WithAsyncEnumerable", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithAsyncEnumerable", + FilePath = @"", + LineNumber = 116, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithAsyncEnumerable + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithTaskWhenAll", + ClassName = "STAThreadTests", + MethodName = "STA_WithTaskWhenAll", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskWhenAll", + FilePath = @"", + LineNumber = 130, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithTaskWhenAll + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithExceptionHandling", + ClassName = "STAThreadTests", + MethodName = "STA_WithExceptionHandling", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithExceptionHandling", + FilePath = @"", + LineNumber = 147, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithExceptionHandling + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithThrowsNothingAssertion", + ClassName = "STAThreadTests", + MethodName = "STA_WithThrowsNothingAssertion", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithThrowsNothingAssertion", + FilePath = @"", + LineNumber = 194, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithThrowsNothingAssertion + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithFuncAssertion", + ClassName = "STAThreadTests", + MethodName = "STA_WithFuncAssertion", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithFuncAssertion", + FilePath = @"", + LineNumber = 211, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + 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), @@ -476,7 +851,62 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTru new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + 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 { @@ -487,42 +917,137 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTru return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata { - TestName = "STA_WithNestedAsyncCalls", + TestName = "With_STA", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), - TestMethodName = "STA_WithNestedAsyncCalls", + TestMethodName = "With_STA", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 54, + LineNumber = 14, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.STAThreadTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STA_WithNestedAsyncCalls", + Name = "With_STA", GenericTypeCount = 0, ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), @@ -539,89 +1064,122 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_ Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_With_STA, + RepeatCount = 100, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Without_STA(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithNestedAsyncCalls", - ClassName = "STAThreadTests", - MethodName = "STA_WithNestedAsyncCalls", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithNestedAsyncCalls", + TestName = "Without_STA", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "Without_STA", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_1, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", - LineNumber = 54, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, + LineNumber = 20, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "Without_STA", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Without_STA, RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithSimpleAwait(string testSessionId) { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithNestedAsyncCalls()); - } - catch (global::System.Exception ex) + var metadata = new global::TUnit.Core.TestMetadata { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } + TestName = "STA_WithSimpleAwait", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithSimpleAwait", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 26, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithSimpleAwait", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithSimpleAwait, + RepeatCount = 100, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithTaskYield(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { - TestName = "STA_WithTaskFromResult", + TestName = "STA_WithTaskYield", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), - TestMethodName = "STA_WithTaskFromResult", + TestMethodName = "STA_WithTaskYield", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 64, + LineNumber = 36, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.STAThreadTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STA_WithTaskFromResult", + Name = "STA_WithTaskYield", GenericTypeCount = 0, ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), @@ -638,89 +1196,122 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_Te Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithTaskYield, + RepeatCount = 100, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithConfigureAwaitTrue(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithTaskFromResult", - ClassName = "STAThreadTests", - MethodName = "STA_WithTaskFromResult", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskFromResult", + TestName = "STA_WithConfigureAwaitTrue", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithConfigureAwaitTrue", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", - LineNumber = 64, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, + LineNumber = 45, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithConfigureAwaitTrue", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithConfigureAwaitTrue, RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithNestedAsyncCalls(string testSessionId) { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskFromResult()); - } - catch (global::System.Exception ex) + var metadata = new global::TUnit.Core.TestMetadata { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + TestName = "STA_WithNestedAsyncCalls", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithNestedAsyncCalls", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 54, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithNestedAsyncCalls", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithNestedAsyncCalls, + RepeatCount = 100, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithTaskFromResult(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { - TestName = "STA_WithCompletedTask", + TestName = "STA_WithTaskFromResult", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), - TestMethodName = "STA_WithCompletedTask", + TestMethodName = "STA_WithTaskFromResult", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, 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, + LineNumber = 64, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.STAThreadTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STA_WithCompletedTask", + Name = "STA_WithTaskFromResult", GenericTypeCount = 0, ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), @@ -737,89 +1328,34 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_Tes Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithTaskFromResult, + RepeatCount = 100, }; 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.STAThreadTests.STA_WithCompletedTask", - ClassName = "STAThreadTests", - MethodName = "STA_WithCompletedTask", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithCompletedTask", - FilePath = @"", - LineNumber = 74, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithCompletedTask()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskRun_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithCompletedTask(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { - TestName = "STA_WithTaskRun", + TestName = "STA_WithCompletedTask", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), - TestMethodName = "STA_WithTaskRun", + TestMethodName = "STA_WithCompletedTask", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 83, + LineNumber = 74, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.STAThreadTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STA_WithTaskRun", + Name = "STA_WithCompletedTask", GenericTypeCount = 0, ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), @@ -836,89 +1372,34 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskRun_TestSourc Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithCompletedTask, + RepeatCount = 100, }; 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.STAThreadTests.STA_WithTaskRun", - ClassName = "STAThreadTests", - MethodName = "STA_WithTaskRun", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskRun", - FilePath = @"", - LineNumber = 83, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskRun()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithTaskRun(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { - TestName = "STA_WithMultipleAwaits", + TestName = "STA_WithTaskRun", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), - TestMethodName = "STA_WithMultipleAwaits", + TestMethodName = "STA_WithTaskRun", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 98, + LineNumber = 83, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.STAThreadTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STA_WithMultipleAwaits", + Name = "STA_WithTaskRun", GenericTypeCount = 0, ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), @@ -935,89 +1416,34 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_Te Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithTaskRun, + RepeatCount = 100, }; 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.STAThreadTests.STA_WithMultipleAwaits", - ClassName = "STAThreadTests", - MethodName = "STA_WithMultipleAwaits", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithMultipleAwaits", - FilePath = @"", - LineNumber = 98, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithMultipleAwaits()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithMultipleAwaits(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { - TestName = "STA_WithAsyncEnumerable", + TestName = "STA_WithMultipleAwaits", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), - TestMethodName = "STA_WithAsyncEnumerable", + TestMethodName = "STA_WithMultipleAwaits", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 116, + LineNumber = 98, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.STAThreadTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STA_WithAsyncEnumerable", + Name = "STA_WithMultipleAwaits", GenericTypeCount = 0, ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), @@ -1028,95 +1454,40 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_T TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), Name = "STAThreadTests", Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.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.STAThreadTests.STA_WithAsyncEnumerable", - ClassName = "STAThreadTests", - MethodName = "STA_WithAsyncEnumerable", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithAsyncEnumerable", - FilePath = @"", - LineNumber = 116, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithAsyncEnumerable()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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_STA_WithMultipleAwaits, + RepeatCount = 100, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithAsyncEnumerable(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { - TestName = "STA_WithTaskWhenAll", + TestName = "STA_WithAsyncEnumerable", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), - TestMethodName = "STA_WithTaskWhenAll", + TestMethodName = "STA_WithAsyncEnumerable", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 130, + LineNumber = 116, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.STAThreadTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STA_WithTaskWhenAll", + Name = "STA_WithAsyncEnumerable", GenericTypeCount = 0, ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), @@ -1133,68 +1504,58 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_TestS Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithAsyncEnumerable, + RepeatCount = 100, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithTaskWhenAll(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithTaskWhenAll", - ClassName = "STAThreadTests", - MethodName = "STA_WithTaskWhenAll", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskWhenAll", + TestName = "STA_WithTaskWhenAll", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithTaskWhenAll", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", LineNumber = 130, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithTaskWhenAll", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithTaskWhenAll, RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskWhenAll()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithExceptionHandling(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -1202,8 +1563,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithExceptionHandling", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -1232,68 +1592,14 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithExceptionHandling, + RepeatCount = 100, }; 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.STAThreadTests.STA_WithExceptionHandling", - ClassName = "STAThreadTests", - MethodName = "STA_WithExceptionHandling", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithExceptionHandling", - FilePath = @"", - LineNumber = 147, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithExceptionHandling()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAssertion_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithThrowsNothingAssertion(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -1301,8 +1607,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAsse TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithThrowsNothingAssertion", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -1331,68 +1636,14 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAsse Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithThrowsNothingAssertion, + RepeatCount = 100, }; 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.STAThreadTests.STA_WithThrowsNothingAssertion", - ClassName = "STAThreadTests", - MethodName = "STA_WithThrowsNothingAssertion", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithThrowsNothingAssertion", - FilePath = @"", - LineNumber = 194, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithThrowsNothingAssertion()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithFuncAssertion(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -1400,8 +1651,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_Tes TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithFuncAssertion", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -1430,67 +1680,13 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_Tes Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithFuncAssertion, + RepeatCount = 100, }; 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.STAThreadTests.STA_WithFuncAssertion", - ClassName = "STAThreadTests", - MethodName = "STA_WithFuncAssertion", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithFuncAssertion", - FilePath = @"", - LineNumber = 211, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithFuncAssertion()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_STAThreadTests__ClassHelper -{ internal static global::TUnit.TestProject.STAThreadTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.STAThreadTests(); @@ -1498,20 +1694,6 @@ internal static class TUnit_TestProject_STAThreadTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTrue_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithTaskRun_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithTaskYield_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAssertion_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_With_STA_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_Without_STA_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests__TestSource()); } } 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 d6c68daf731..bea60945c07 100644 --- a/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet8_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet8_0.verified.txt @@ -5,18 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_With_STA_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_STAThreadTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_With_STA = new global::TUnit.Core.TestMetadata { TestName = "With_STA", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "With_STA", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -45,77 +44,18 @@ internal sealed class TUnit_TestProject_STAThreadTests_With_STA_TestSource : glo Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.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.STAThreadTests.With_STA", - ClassName = "STAThreadTests", - MethodName = "With_STA", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.With_STA", - FilePath = @"", - LineNumber = 14, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_With_STA, RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.With_STA()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_Without_STA_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_With_STA.UseRuntimeDataGeneration(testSessionId); + var metadata_Without_STA = new global::TUnit.Core.TestMetadata { TestName = "Without_STA", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "Without_STA", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_1, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -144,76 +84,18 @@ internal sealed class TUnit_TestProject_STAThreadTests_Without_STA_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.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.STAThreadTests.Without_STA", - ClassName = "STAThreadTests", - MethodName = "Without_STA", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.Without_STA", - FilePath = @"", - LineNumber = 20, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Without_STA, RepeatCount = 100, - 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.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(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)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_Without_STA.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithSimpleAwait = new global::TUnit.Core.TestMetadata { TestName = "STA_WithSimpleAwait", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithSimpleAwait", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -242,77 +124,18 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_TestS Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.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.STAThreadTests.STA_WithSimpleAwait", - ClassName = "STAThreadTests", - MethodName = "STA_WithSimpleAwait", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithSimpleAwait", - FilePath = @"", - LineNumber = 26, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithSimpleAwait, RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithSimpleAwait()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskYield_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_STA_WithSimpleAwait.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithTaskYield = new global::TUnit.Core.TestMetadata { TestName = "STA_WithTaskYield", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithTaskYield", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -341,77 +164,18 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskYield_TestSou Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.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.STAThreadTests.STA_WithTaskYield", - ClassName = "STAThreadTests", - MethodName = "STA_WithTaskYield", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskYield", - FilePath = @"", - LineNumber = 36, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithTaskYield, RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskYield()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTrue_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_STA_WithTaskYield.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithConfigureAwaitTrue = new global::TUnit.Core.TestMetadata { TestName = "STA_WithConfigureAwaitTrue", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithConfigureAwaitTrue", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -440,34 +204,645 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTru Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithConfigureAwaitTrue, + RepeatCount = 100, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor + metadata_STA_WithConfigureAwaitTrue.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithNestedAsyncCalls = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithConfigureAwaitTrue", - ClassName = "STAThreadTests", - MethodName = "STA_WithConfigureAwaitTrue", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithConfigureAwaitTrue", + TestName = "STA_WithNestedAsyncCalls", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithNestedAsyncCalls", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", - LineNumber = 45, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ + LineNumber = 54, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithNestedAsyncCalls", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithNestedAsyncCalls, + RepeatCount = 100, + }; + metadata_STA_WithNestedAsyncCalls.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithTaskFromResult = new global::TUnit.Core.TestMetadata + { + TestName = "STA_WithTaskFromResult", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithTaskFromResult", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 64, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithTaskFromResult", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithTaskFromResult, + RepeatCount = 100, + }; + metadata_STA_WithTaskFromResult.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithCompletedTask = new global::TUnit.Core.TestMetadata + { + TestName = "STA_WithCompletedTask", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithCompletedTask", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithCompletedTask", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithCompletedTask, + RepeatCount = 100, + }; + metadata_STA_WithCompletedTask.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithTaskRun = new global::TUnit.Core.TestMetadata + { + TestName = "STA_WithTaskRun", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithTaskRun", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 83, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithTaskRun", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithTaskRun, + RepeatCount = 100, + }; + metadata_STA_WithTaskRun.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithMultipleAwaits = new global::TUnit.Core.TestMetadata + { + TestName = "STA_WithMultipleAwaits", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithMultipleAwaits", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 98, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithMultipleAwaits", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithMultipleAwaits, + RepeatCount = 100, + }; + metadata_STA_WithMultipleAwaits.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithAsyncEnumerable = new global::TUnit.Core.TestMetadata + { + TestName = "STA_WithAsyncEnumerable", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithAsyncEnumerable", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 116, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithAsyncEnumerable", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithAsyncEnumerable, + RepeatCount = 100, + }; + metadata_STA_WithAsyncEnumerable.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithTaskWhenAll = new global::TUnit.Core.TestMetadata + { + TestName = "STA_WithTaskWhenAll", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithTaskWhenAll", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 130, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithTaskWhenAll", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithTaskWhenAll, + RepeatCount = 100, + }; + metadata_STA_WithTaskWhenAll.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithExceptionHandling = new global::TUnit.Core.TestMetadata + { + TestName = "STA_WithExceptionHandling", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithExceptionHandling", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 147, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithExceptionHandling", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithExceptionHandling, + RepeatCount = 100, + }; + metadata_STA_WithExceptionHandling.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithThrowsNothingAssertion = new global::TUnit.Core.TestMetadata + { + TestName = "STA_WithThrowsNothingAssertion", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithThrowsNothingAssertion", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 194, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithThrowsNothingAssertion", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithThrowsNothingAssertion, + RepeatCount = 100, + }; + metadata_STA_WithThrowsNothingAssertion.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithFuncAssertion = new global::TUnit.Core.TestMetadata + { + TestName = "STA_WithFuncAssertion", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithFuncAssertion", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 211, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithFuncAssertion", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithFuncAssertion, + RepeatCount = 100, + }; + metadata_STA_WithFuncAssertion.UseRuntimeDataGeneration(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 }; + } + public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + { + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.With_STA", + ClassName = "STAThreadTests", + MethodName = "With_STA", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.With_STA", + FilePath = @"", + LineNumber = 14, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_With_STA + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.Without_STA", + ClassName = "STAThreadTests", + MethodName = "Without_STA", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.Without_STA", + FilePath = @"", + LineNumber = 20, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Without_STA + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithSimpleAwait", + ClassName = "STAThreadTests", + MethodName = "STA_WithSimpleAwait", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithSimpleAwait", + FilePath = @"", + LineNumber = 26, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithSimpleAwait + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithTaskYield", + ClassName = "STAThreadTests", + MethodName = "STA_WithTaskYield", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskYield", + FilePath = @"", + LineNumber = 36, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithTaskYield + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithConfigureAwaitTrue", + ClassName = "STAThreadTests", + MethodName = "STA_WithConfigureAwaitTrue", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithConfigureAwaitTrue", + FilePath = @"", + LineNumber = 45, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithConfigureAwaitTrue + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithNestedAsyncCalls", + ClassName = "STAThreadTests", + MethodName = "STA_WithNestedAsyncCalls", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithNestedAsyncCalls", + FilePath = @"", + LineNumber = 54, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithNestedAsyncCalls + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithTaskFromResult", + ClassName = "STAThreadTests", + MethodName = "STA_WithTaskFromResult", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskFromResult", + FilePath = @"", + LineNumber = 64, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithTaskFromResult + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithCompletedTask", + ClassName = "STAThreadTests", + MethodName = "STA_WithCompletedTask", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithCompletedTask", + FilePath = @"", + LineNumber = 74, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithCompletedTask + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithTaskRun", + ClassName = "STAThreadTests", + MethodName = "STA_WithTaskRun", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskRun", + FilePath = @"", + LineNumber = 83, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithTaskRun + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithMultipleAwaits", + ClassName = "STAThreadTests", + MethodName = "STA_WithMultipleAwaits", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithMultipleAwaits", + FilePath = @"", + LineNumber = 98, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithMultipleAwaits + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithAsyncEnumerable", + ClassName = "STAThreadTests", + MethodName = "STA_WithAsyncEnumerable", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithAsyncEnumerable", + FilePath = @"", + LineNumber = 116, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithAsyncEnumerable + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithTaskWhenAll", + ClassName = "STAThreadTests", + MethodName = "STA_WithTaskWhenAll", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskWhenAll", + FilePath = @"", + LineNumber = 130, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithTaskWhenAll + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithExceptionHandling", + ClassName = "STAThreadTests", + MethodName = "STA_WithExceptionHandling", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithExceptionHandling", + FilePath = @"", + LineNumber = 147, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithExceptionHandling + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithThrowsNothingAssertion", + ClassName = "STAThreadTests", + MethodName = "STA_WithThrowsNothingAssertion", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithThrowsNothingAssertion", + FilePath = @"", + LineNumber = 194, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithThrowsNothingAssertion + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithFuncAssertion", + ClassName = "STAThreadTests", + MethodName = "STA_WithFuncAssertion", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithFuncAssertion", + FilePath = @"", + LineNumber = 211, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + 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), @@ -476,7 +851,62 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTru new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + 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 { @@ -487,42 +917,137 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTru return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata { - TestName = "STA_WithNestedAsyncCalls", + TestName = "With_STA", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), - TestMethodName = "STA_WithNestedAsyncCalls", + TestMethodName = "With_STA", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 54, + LineNumber = 14, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.STAThreadTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STA_WithNestedAsyncCalls", + Name = "With_STA", GenericTypeCount = 0, ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), @@ -539,89 +1064,122 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_ Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_With_STA, + RepeatCount = 100, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Without_STA(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithNestedAsyncCalls", - ClassName = "STAThreadTests", - MethodName = "STA_WithNestedAsyncCalls", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithNestedAsyncCalls", + TestName = "Without_STA", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "Without_STA", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_1, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", - LineNumber = 54, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, + LineNumber = 20, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "Without_STA", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Without_STA, RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithSimpleAwait(string testSessionId) { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithNestedAsyncCalls()); - } - catch (global::System.Exception ex) + var metadata = new global::TUnit.Core.TestMetadata { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } + TestName = "STA_WithSimpleAwait", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithSimpleAwait", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 26, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithSimpleAwait", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithSimpleAwait, + RepeatCount = 100, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithTaskYield(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { - TestName = "STA_WithTaskFromResult", + TestName = "STA_WithTaskYield", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), - TestMethodName = "STA_WithTaskFromResult", + TestMethodName = "STA_WithTaskYield", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 64, + LineNumber = 36, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.STAThreadTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STA_WithTaskFromResult", + Name = "STA_WithTaskYield", GenericTypeCount = 0, ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), @@ -638,89 +1196,122 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_Te Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithTaskYield, + RepeatCount = 100, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithConfigureAwaitTrue(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithTaskFromResult", - ClassName = "STAThreadTests", - MethodName = "STA_WithTaskFromResult", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskFromResult", + TestName = "STA_WithConfigureAwaitTrue", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithConfigureAwaitTrue", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", - LineNumber = 64, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, + LineNumber = 45, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithConfigureAwaitTrue", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithConfigureAwaitTrue, RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithNestedAsyncCalls(string testSessionId) { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskFromResult()); - } - catch (global::System.Exception ex) + var metadata = new global::TUnit.Core.TestMetadata { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + TestName = "STA_WithNestedAsyncCalls", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithNestedAsyncCalls", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 54, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithNestedAsyncCalls", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithNestedAsyncCalls, + RepeatCount = 100, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithTaskFromResult(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { - TestName = "STA_WithCompletedTask", + TestName = "STA_WithTaskFromResult", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), - TestMethodName = "STA_WithCompletedTask", + TestMethodName = "STA_WithTaskFromResult", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, 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, + LineNumber = 64, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.STAThreadTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STA_WithCompletedTask", + Name = "STA_WithTaskFromResult", GenericTypeCount = 0, ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), @@ -737,89 +1328,34 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_Tes Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithTaskFromResult, + RepeatCount = 100, }; 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.STAThreadTests.STA_WithCompletedTask", - ClassName = "STAThreadTests", - MethodName = "STA_WithCompletedTask", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithCompletedTask", - FilePath = @"", - LineNumber = 74, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithCompletedTask()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskRun_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithCompletedTask(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { - TestName = "STA_WithTaskRun", + TestName = "STA_WithCompletedTask", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), - TestMethodName = "STA_WithTaskRun", + TestMethodName = "STA_WithCompletedTask", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 83, + LineNumber = 74, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.STAThreadTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STA_WithTaskRun", + Name = "STA_WithCompletedTask", GenericTypeCount = 0, ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), @@ -836,89 +1372,34 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskRun_TestSourc Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithCompletedTask, + RepeatCount = 100, }; 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.STAThreadTests.STA_WithTaskRun", - ClassName = "STAThreadTests", - MethodName = "STA_WithTaskRun", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskRun", - FilePath = @"", - LineNumber = 83, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskRun()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithTaskRun(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { - TestName = "STA_WithMultipleAwaits", + TestName = "STA_WithTaskRun", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), - TestMethodName = "STA_WithMultipleAwaits", + TestMethodName = "STA_WithTaskRun", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 98, + LineNumber = 83, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.STAThreadTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STA_WithMultipleAwaits", + Name = "STA_WithTaskRun", GenericTypeCount = 0, ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), @@ -935,89 +1416,34 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_Te Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithTaskRun, + RepeatCount = 100, }; 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.STAThreadTests.STA_WithMultipleAwaits", - ClassName = "STAThreadTests", - MethodName = "STA_WithMultipleAwaits", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithMultipleAwaits", - FilePath = @"", - LineNumber = 98, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithMultipleAwaits()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithMultipleAwaits(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { - TestName = "STA_WithAsyncEnumerable", + TestName = "STA_WithMultipleAwaits", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), - TestMethodName = "STA_WithAsyncEnumerable", + TestMethodName = "STA_WithMultipleAwaits", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 116, + LineNumber = 98, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.STAThreadTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STA_WithAsyncEnumerable", + Name = "STA_WithMultipleAwaits", GenericTypeCount = 0, ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), @@ -1028,95 +1454,40 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_T TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), Name = "STAThreadTests", Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.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.STAThreadTests.STA_WithAsyncEnumerable", - ClassName = "STAThreadTests", - MethodName = "STA_WithAsyncEnumerable", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithAsyncEnumerable", - FilePath = @"", - LineNumber = 116, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithAsyncEnumerable()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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_STA_WithMultipleAwaits, + RepeatCount = 100, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithAsyncEnumerable(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { - TestName = "STA_WithTaskWhenAll", + TestName = "STA_WithAsyncEnumerable", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), - TestMethodName = "STA_WithTaskWhenAll", + TestMethodName = "STA_WithAsyncEnumerable", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 130, + LineNumber = 116, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.STAThreadTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STA_WithTaskWhenAll", + Name = "STA_WithAsyncEnumerable", GenericTypeCount = 0, ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), @@ -1133,68 +1504,58 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_TestS Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithAsyncEnumerable, + RepeatCount = 100, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithTaskWhenAll(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithTaskWhenAll", - ClassName = "STAThreadTests", - MethodName = "STA_WithTaskWhenAll", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskWhenAll", + TestName = "STA_WithTaskWhenAll", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithTaskWhenAll", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", LineNumber = 130, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithTaskWhenAll", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithTaskWhenAll, RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskWhenAll()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithExceptionHandling(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -1202,8 +1563,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithExceptionHandling", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -1232,68 +1592,14 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithExceptionHandling, + RepeatCount = 100, }; 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.STAThreadTests.STA_WithExceptionHandling", - ClassName = "STAThreadTests", - MethodName = "STA_WithExceptionHandling", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithExceptionHandling", - FilePath = @"", - LineNumber = 147, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithExceptionHandling()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAssertion_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithThrowsNothingAssertion(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -1301,8 +1607,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAsse TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithThrowsNothingAssertion", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -1331,68 +1636,14 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAsse Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithThrowsNothingAssertion, + RepeatCount = 100, }; 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.STAThreadTests.STA_WithThrowsNothingAssertion", - ClassName = "STAThreadTests", - MethodName = "STA_WithThrowsNothingAssertion", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithThrowsNothingAssertion", - FilePath = @"", - LineNumber = 194, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithThrowsNothingAssertion()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithFuncAssertion(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -1400,8 +1651,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_Tes TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithFuncAssertion", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -1430,67 +1680,13 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_Tes Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithFuncAssertion, + RepeatCount = 100, }; 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.STAThreadTests.STA_WithFuncAssertion", - ClassName = "STAThreadTests", - MethodName = "STA_WithFuncAssertion", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithFuncAssertion", - FilePath = @"", - LineNumber = 211, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithFuncAssertion()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_STAThreadTests__ClassHelper -{ internal static global::TUnit.TestProject.STAThreadTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.STAThreadTests(); @@ -1498,20 +1694,6 @@ internal static class TUnit_TestProject_STAThreadTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTrue_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithTaskRun_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithTaskYield_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAssertion_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_With_STA_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_Without_STA_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests__TestSource()); } } 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 d6c68daf731..bea60945c07 100644 --- a/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet9_0.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.DotNet9_0.verified.txt @@ -5,18 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_With_STA_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_STAThreadTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_With_STA = new global::TUnit.Core.TestMetadata { TestName = "With_STA", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "With_STA", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -45,77 +44,18 @@ internal sealed class TUnit_TestProject_STAThreadTests_With_STA_TestSource : glo Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.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.STAThreadTests.With_STA", - ClassName = "STAThreadTests", - MethodName = "With_STA", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.With_STA", - FilePath = @"", - LineNumber = 14, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_With_STA, RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.With_STA()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_Without_STA_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_With_STA.UseRuntimeDataGeneration(testSessionId); + var metadata_Without_STA = new global::TUnit.Core.TestMetadata { TestName = "Without_STA", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "Without_STA", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_1, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -144,76 +84,18 @@ internal sealed class TUnit_TestProject_STAThreadTests_Without_STA_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.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.STAThreadTests.Without_STA", - ClassName = "STAThreadTests", - MethodName = "Without_STA", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.Without_STA", - FilePath = @"", - LineNumber = 20, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Without_STA, RepeatCount = 100, - 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.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(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)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_Without_STA.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithSimpleAwait = new global::TUnit.Core.TestMetadata { TestName = "STA_WithSimpleAwait", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithSimpleAwait", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -242,77 +124,18 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_TestS Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.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.STAThreadTests.STA_WithSimpleAwait", - ClassName = "STAThreadTests", - MethodName = "STA_WithSimpleAwait", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithSimpleAwait", - FilePath = @"", - LineNumber = 26, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithSimpleAwait, RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithSimpleAwait()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskYield_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_STA_WithSimpleAwait.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithTaskYield = new global::TUnit.Core.TestMetadata { TestName = "STA_WithTaskYield", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithTaskYield", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -341,77 +164,18 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskYield_TestSou Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.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.STAThreadTests.STA_WithTaskYield", - ClassName = "STAThreadTests", - MethodName = "STA_WithTaskYield", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskYield", - FilePath = @"", - LineNumber = 36, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithTaskYield, RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskYield()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTrue_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_STA_WithTaskYield.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithConfigureAwaitTrue = new global::TUnit.Core.TestMetadata { TestName = "STA_WithConfigureAwaitTrue", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithConfigureAwaitTrue", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -440,34 +204,645 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTru Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithConfigureAwaitTrue, + RepeatCount = 100, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor + metadata_STA_WithConfigureAwaitTrue.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithNestedAsyncCalls = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithConfigureAwaitTrue", - ClassName = "STAThreadTests", - MethodName = "STA_WithConfigureAwaitTrue", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithConfigureAwaitTrue", + TestName = "STA_WithNestedAsyncCalls", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithNestedAsyncCalls", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", - LineNumber = 45, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ + LineNumber = 54, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithNestedAsyncCalls", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithNestedAsyncCalls, + RepeatCount = 100, + }; + metadata_STA_WithNestedAsyncCalls.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithTaskFromResult = new global::TUnit.Core.TestMetadata + { + TestName = "STA_WithTaskFromResult", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithTaskFromResult", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 64, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithTaskFromResult", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithTaskFromResult, + RepeatCount = 100, + }; + metadata_STA_WithTaskFromResult.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithCompletedTask = new global::TUnit.Core.TestMetadata + { + TestName = "STA_WithCompletedTask", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithCompletedTask", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithCompletedTask", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithCompletedTask, + RepeatCount = 100, + }; + metadata_STA_WithCompletedTask.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithTaskRun = new global::TUnit.Core.TestMetadata + { + TestName = "STA_WithTaskRun", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithTaskRun", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 83, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithTaskRun", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithTaskRun, + RepeatCount = 100, + }; + metadata_STA_WithTaskRun.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithMultipleAwaits = new global::TUnit.Core.TestMetadata + { + TestName = "STA_WithMultipleAwaits", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithMultipleAwaits", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 98, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithMultipleAwaits", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithMultipleAwaits, + RepeatCount = 100, + }; + metadata_STA_WithMultipleAwaits.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithAsyncEnumerable = new global::TUnit.Core.TestMetadata + { + TestName = "STA_WithAsyncEnumerable", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithAsyncEnumerable", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 116, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithAsyncEnumerable", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithAsyncEnumerable, + RepeatCount = 100, + }; + metadata_STA_WithAsyncEnumerable.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithTaskWhenAll = new global::TUnit.Core.TestMetadata + { + TestName = "STA_WithTaskWhenAll", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithTaskWhenAll", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 130, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithTaskWhenAll", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithTaskWhenAll, + RepeatCount = 100, + }; + metadata_STA_WithTaskWhenAll.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithExceptionHandling = new global::TUnit.Core.TestMetadata + { + TestName = "STA_WithExceptionHandling", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithExceptionHandling", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 147, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithExceptionHandling", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithExceptionHandling, + RepeatCount = 100, + }; + metadata_STA_WithExceptionHandling.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithThrowsNothingAssertion = new global::TUnit.Core.TestMetadata + { + TestName = "STA_WithThrowsNothingAssertion", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithThrowsNothingAssertion", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 194, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithThrowsNothingAssertion", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithThrowsNothingAssertion, + RepeatCount = 100, + }; + metadata_STA_WithThrowsNothingAssertion.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithFuncAssertion = new global::TUnit.Core.TestMetadata + { + TestName = "STA_WithFuncAssertion", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithFuncAssertion", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 211, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithFuncAssertion", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithFuncAssertion, + RepeatCount = 100, + }; + metadata_STA_WithFuncAssertion.UseRuntimeDataGeneration(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 }; + } + public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + { + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.With_STA", + ClassName = "STAThreadTests", + MethodName = "With_STA", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.With_STA", + FilePath = @"", + LineNumber = 14, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_With_STA + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.Without_STA", + ClassName = "STAThreadTests", + MethodName = "Without_STA", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.Without_STA", + FilePath = @"", + LineNumber = 20, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Without_STA + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithSimpleAwait", + ClassName = "STAThreadTests", + MethodName = "STA_WithSimpleAwait", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithSimpleAwait", + FilePath = @"", + LineNumber = 26, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithSimpleAwait + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithTaskYield", + ClassName = "STAThreadTests", + MethodName = "STA_WithTaskYield", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskYield", + FilePath = @"", + LineNumber = 36, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithTaskYield + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithConfigureAwaitTrue", + ClassName = "STAThreadTests", + MethodName = "STA_WithConfigureAwaitTrue", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithConfigureAwaitTrue", + FilePath = @"", + LineNumber = 45, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithConfigureAwaitTrue + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithNestedAsyncCalls", + ClassName = "STAThreadTests", + MethodName = "STA_WithNestedAsyncCalls", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithNestedAsyncCalls", + FilePath = @"", + LineNumber = 54, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithNestedAsyncCalls + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithTaskFromResult", + ClassName = "STAThreadTests", + MethodName = "STA_WithTaskFromResult", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskFromResult", + FilePath = @"", + LineNumber = 64, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithTaskFromResult + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithCompletedTask", + ClassName = "STAThreadTests", + MethodName = "STA_WithCompletedTask", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithCompletedTask", + FilePath = @"", + LineNumber = 74, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithCompletedTask + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithTaskRun", + ClassName = "STAThreadTests", + MethodName = "STA_WithTaskRun", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskRun", + FilePath = @"", + LineNumber = 83, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithTaskRun + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithMultipleAwaits", + ClassName = "STAThreadTests", + MethodName = "STA_WithMultipleAwaits", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithMultipleAwaits", + FilePath = @"", + LineNumber = 98, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithMultipleAwaits + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithAsyncEnumerable", + ClassName = "STAThreadTests", + MethodName = "STA_WithAsyncEnumerable", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithAsyncEnumerable", + FilePath = @"", + LineNumber = 116, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithAsyncEnumerable + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithTaskWhenAll", + ClassName = "STAThreadTests", + MethodName = "STA_WithTaskWhenAll", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskWhenAll", + FilePath = @"", + LineNumber = 130, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithTaskWhenAll + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithExceptionHandling", + ClassName = "STAThreadTests", + MethodName = "STA_WithExceptionHandling", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithExceptionHandling", + FilePath = @"", + LineNumber = 147, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithExceptionHandling + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithThrowsNothingAssertion", + ClassName = "STAThreadTests", + MethodName = "STA_WithThrowsNothingAssertion", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithThrowsNothingAssertion", + FilePath = @"", + LineNumber = 194, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithThrowsNothingAssertion + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithFuncAssertion", + ClassName = "STAThreadTests", + MethodName = "STA_WithFuncAssertion", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithFuncAssertion", + FilePath = @"", + LineNumber = 211, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + 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), @@ -476,7 +851,62 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTru new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + 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 { @@ -487,42 +917,137 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTru return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata { - TestName = "STA_WithNestedAsyncCalls", + TestName = "With_STA", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), - TestMethodName = "STA_WithNestedAsyncCalls", + TestMethodName = "With_STA", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 54, + LineNumber = 14, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.STAThreadTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STA_WithNestedAsyncCalls", + Name = "With_STA", GenericTypeCount = 0, ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), @@ -539,89 +1064,122 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_ Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_With_STA, + RepeatCount = 100, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Without_STA(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithNestedAsyncCalls", - ClassName = "STAThreadTests", - MethodName = "STA_WithNestedAsyncCalls", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithNestedAsyncCalls", + TestName = "Without_STA", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "Without_STA", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_1, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", - LineNumber = 54, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, + LineNumber = 20, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "Without_STA", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Without_STA, RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithSimpleAwait(string testSessionId) { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithNestedAsyncCalls()); - } - catch (global::System.Exception ex) + var metadata = new global::TUnit.Core.TestMetadata { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } + TestName = "STA_WithSimpleAwait", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithSimpleAwait", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 26, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithSimpleAwait", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithSimpleAwait, + RepeatCount = 100, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithTaskYield(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { - TestName = "STA_WithTaskFromResult", + TestName = "STA_WithTaskYield", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), - TestMethodName = "STA_WithTaskFromResult", + TestMethodName = "STA_WithTaskYield", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 64, + LineNumber = 36, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.STAThreadTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STA_WithTaskFromResult", + Name = "STA_WithTaskYield", GenericTypeCount = 0, ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), @@ -638,89 +1196,122 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_Te Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithTaskYield, + RepeatCount = 100, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithConfigureAwaitTrue(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithTaskFromResult", - ClassName = "STAThreadTests", - MethodName = "STA_WithTaskFromResult", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskFromResult", + TestName = "STA_WithConfigureAwaitTrue", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithConfigureAwaitTrue", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", - LineNumber = 64, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, + LineNumber = 45, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithConfigureAwaitTrue", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithConfigureAwaitTrue, RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithNestedAsyncCalls(string testSessionId) { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskFromResult()); - } - catch (global::System.Exception ex) + var metadata = new global::TUnit.Core.TestMetadata { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + TestName = "STA_WithNestedAsyncCalls", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithNestedAsyncCalls", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 54, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithNestedAsyncCalls", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithNestedAsyncCalls, + RepeatCount = 100, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithTaskFromResult(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { - TestName = "STA_WithCompletedTask", + TestName = "STA_WithTaskFromResult", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), - TestMethodName = "STA_WithCompletedTask", + TestMethodName = "STA_WithTaskFromResult", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, 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, + LineNumber = 64, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.STAThreadTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STA_WithCompletedTask", + Name = "STA_WithTaskFromResult", GenericTypeCount = 0, ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), @@ -737,89 +1328,34 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_Tes Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithTaskFromResult, + RepeatCount = 100, }; 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.STAThreadTests.STA_WithCompletedTask", - ClassName = "STAThreadTests", - MethodName = "STA_WithCompletedTask", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithCompletedTask", - FilePath = @"", - LineNumber = 74, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithCompletedTask()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskRun_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithCompletedTask(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { - TestName = "STA_WithTaskRun", + TestName = "STA_WithCompletedTask", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), - TestMethodName = "STA_WithTaskRun", + TestMethodName = "STA_WithCompletedTask", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 83, + LineNumber = 74, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.STAThreadTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STA_WithTaskRun", + Name = "STA_WithCompletedTask", GenericTypeCount = 0, ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), @@ -836,89 +1372,34 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskRun_TestSourc Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithCompletedTask, + RepeatCount = 100, }; 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.STAThreadTests.STA_WithTaskRun", - ClassName = "STAThreadTests", - MethodName = "STA_WithTaskRun", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskRun", - FilePath = @"", - LineNumber = 83, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskRun()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithTaskRun(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { - TestName = "STA_WithMultipleAwaits", + TestName = "STA_WithTaskRun", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), - TestMethodName = "STA_WithMultipleAwaits", + TestMethodName = "STA_WithTaskRun", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 98, + LineNumber = 83, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.STAThreadTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STA_WithMultipleAwaits", + Name = "STA_WithTaskRun", GenericTypeCount = 0, ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), @@ -935,89 +1416,34 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_Te Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithTaskRun, + RepeatCount = 100, }; 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.STAThreadTests.STA_WithMultipleAwaits", - ClassName = "STAThreadTests", - MethodName = "STA_WithMultipleAwaits", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithMultipleAwaits", - FilePath = @"", - LineNumber = 98, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithMultipleAwaits()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithMultipleAwaits(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { - TestName = "STA_WithAsyncEnumerable", + TestName = "STA_WithMultipleAwaits", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), - TestMethodName = "STA_WithAsyncEnumerable", + TestMethodName = "STA_WithMultipleAwaits", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 116, + LineNumber = 98, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.STAThreadTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STA_WithAsyncEnumerable", + Name = "STA_WithMultipleAwaits", GenericTypeCount = 0, ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), @@ -1028,95 +1454,40 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_T TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), Name = "STAThreadTests", Namespace = "TUnit.TestProject", - Assembly = global::TUnit.Core.AssemblyMetadata.GetOrAdd("TestsBase`1", "TestsBase`1"), - Parameters = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - Parent = null - }) - }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.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.STAThreadTests.STA_WithAsyncEnumerable", - ClassName = "STAThreadTests", - MethodName = "STA_WithAsyncEnumerable", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithAsyncEnumerable", - FilePath = @"", - LineNumber = 116, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithAsyncEnumerable()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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_STA_WithMultipleAwaits, + RepeatCount = 100, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithAsyncEnumerable(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { - TestName = "STA_WithTaskWhenAll", + TestName = "STA_WithAsyncEnumerable", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), - TestMethodName = "STA_WithTaskWhenAll", + TestMethodName = "STA_WithAsyncEnumerable", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 130, + LineNumber = 116, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.STAThreadTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STA_WithTaskWhenAll", + Name = "STA_WithAsyncEnumerable", GenericTypeCount = 0, ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), @@ -1133,68 +1504,58 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_TestS Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithAsyncEnumerable, + RepeatCount = 100, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithTaskWhenAll(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithTaskWhenAll", - ClassName = "STAThreadTests", - MethodName = "STA_WithTaskWhenAll", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskWhenAll", + TestName = "STA_WithTaskWhenAll", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithTaskWhenAll", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", LineNumber = 130, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithTaskWhenAll", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithTaskWhenAll, RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskWhenAll()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithExceptionHandling(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -1202,8 +1563,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithExceptionHandling", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -1232,68 +1592,14 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithExceptionHandling, + RepeatCount = 100, }; 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.STAThreadTests.STA_WithExceptionHandling", - ClassName = "STAThreadTests", - MethodName = "STA_WithExceptionHandling", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithExceptionHandling", - FilePath = @"", - LineNumber = 147, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithExceptionHandling()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAssertion_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithThrowsNothingAssertion(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -1301,8 +1607,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAsse TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithThrowsNothingAssertion", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -1331,68 +1636,14 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAsse Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithThrowsNothingAssertion, + RepeatCount = 100, }; 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.STAThreadTests.STA_WithThrowsNothingAssertion", - ClassName = "STAThreadTests", - MethodName = "STA_WithThrowsNothingAssertion", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithThrowsNothingAssertion", - FilePath = @"", - LineNumber = 194, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithThrowsNothingAssertion()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithFuncAssertion(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -1400,8 +1651,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_Tes TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithFuncAssertion", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -1430,67 +1680,13 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_Tes Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithFuncAssertion, + RepeatCount = 100, }; 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.STAThreadTests.STA_WithFuncAssertion", - ClassName = "STAThreadTests", - MethodName = "STA_WithFuncAssertion", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithFuncAssertion", - FilePath = @"", - LineNumber = 211, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithFuncAssertion()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_STAThreadTests__ClassHelper -{ internal static global::TUnit.TestProject.STAThreadTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.STAThreadTests(); @@ -1498,20 +1694,6 @@ internal static class TUnit_TestProject_STAThreadTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTrue_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithTaskRun_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithTaskYield_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAssertion_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_With_STA_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_Without_STA_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests__TestSource()); } } 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 53d1e6f721f..d825bd72733 100644 --- a/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.Net4_7.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/STAThreadTests.Test.Net4_7.verified.txt @@ -5,18 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_With_STA_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_STAThreadTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_With_STA = new global::TUnit.Core.TestMetadata { TestName = "With_STA", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "With_STA", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -45,77 +44,18 @@ internal sealed class TUnit_TestProject_STAThreadTests_With_STA_TestSource : glo Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.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.STAThreadTests.With_STA", - ClassName = "STAThreadTests", - MethodName = "With_STA", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.With_STA", - FilePath = @"", - LineNumber = 14, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_With_STA, RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.With_STA()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_Without_STA_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_With_STA.UseRuntimeDataGeneration(testSessionId); + var metadata_Without_STA = new global::TUnit.Core.TestMetadata { TestName = "Without_STA", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "Without_STA", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_1, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -144,76 +84,18 @@ internal sealed class TUnit_TestProject_STAThreadTests_Without_STA_TestSource : Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.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.STAThreadTests.Without_STA", - ClassName = "STAThreadTests", - MethodName = "Without_STA", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.Without_STA", - FilePath = @"", - LineNumber = 20, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Without_STA, RepeatCount = 100, - 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.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(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)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_Without_STA.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithSimpleAwait = new global::TUnit.Core.TestMetadata { TestName = "STA_WithSimpleAwait", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithSimpleAwait", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -242,77 +124,18 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_TestS Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.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.STAThreadTests.STA_WithSimpleAwait", - ClassName = "STAThreadTests", - MethodName = "STA_WithSimpleAwait", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithSimpleAwait", - FilePath = @"", - LineNumber = 26, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithSimpleAwait, RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithSimpleAwait()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskYield_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_STA_WithSimpleAwait.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithTaskYield = new global::TUnit.Core.TestMetadata { TestName = "STA_WithTaskYield", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithTaskYield", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -341,77 +164,18 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskYield_TestSou Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.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.STAThreadTests.STA_WithTaskYield", - ClassName = "STAThreadTests", - MethodName = "STA_WithTaskYield", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskYield", - FilePath = @"", - LineNumber = 36, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithTaskYield, RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskYield()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTrue_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_STA_WithTaskYield.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithConfigureAwaitTrue = new global::TUnit.Core.TestMetadata { TestName = "STA_WithConfigureAwaitTrue", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithConfigureAwaitTrue", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -440,77 +204,18 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTru Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.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.STAThreadTests.STA_WithConfigureAwaitTrue", - ClassName = "STAThreadTests", - MethodName = "STA_WithConfigureAwaitTrue", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithConfigureAwaitTrue", - FilePath = @"", - LineNumber = 45, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithConfigureAwaitTrue, RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithConfigureAwaitTrue()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_STA_WithConfigureAwaitTrue.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithNestedAsyncCalls = new global::TUnit.Core.TestMetadata { TestName = "STA_WithNestedAsyncCalls", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithNestedAsyncCalls", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -539,77 +244,18 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_ Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.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.STAThreadTests.STA_WithNestedAsyncCalls", - ClassName = "STAThreadTests", - MethodName = "STA_WithNestedAsyncCalls", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithNestedAsyncCalls", - FilePath = @"", - LineNumber = 54, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithNestedAsyncCalls, RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithNestedAsyncCalls()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_STA_WithNestedAsyncCalls.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithTaskFromResult = new global::TUnit.Core.TestMetadata { TestName = "STA_WithTaskFromResult", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithTaskFromResult", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -638,77 +284,18 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_Te Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.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.STAThreadTests.STA_WithTaskFromResult", - ClassName = "STAThreadTests", - MethodName = "STA_WithTaskFromResult", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskFromResult", - FilePath = @"", - LineNumber = 64, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithTaskFromResult, RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskFromResult()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_STA_WithTaskFromResult.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithCompletedTask = new global::TUnit.Core.TestMetadata { TestName = "STA_WithCompletedTask", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithCompletedTask", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -737,77 +324,18 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_Tes Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.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.STAThreadTests.STA_WithCompletedTask", - ClassName = "STAThreadTests", - MethodName = "STA_WithCompletedTask", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithCompletedTask", - FilePath = @"", - LineNumber = 74, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithCompletedTask, RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithCompletedTask()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskRun_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_STA_WithCompletedTask.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithTaskRun = new global::TUnit.Core.TestMetadata { TestName = "STA_WithTaskRun", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithTaskRun", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -836,77 +364,18 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskRun_TestSourc Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.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.STAThreadTests.STA_WithTaskRun", - ClassName = "STAThreadTests", - MethodName = "STA_WithTaskRun", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskRun", - FilePath = @"", - LineNumber = 83, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithTaskRun, RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskRun()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_STA_WithTaskRun.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithMultipleAwaits = new global::TUnit.Core.TestMetadata { TestName = "STA_WithMultipleAwaits", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithMultipleAwaits", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -935,89 +404,914 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_Te Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithMultipleAwaits, + RepeatCount = 100, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor + metadata_STA_WithMultipleAwaits.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithAsyncEnumerable = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithMultipleAwaits", - ClassName = "STAThreadTests", - MethodName = "STA_WithMultipleAwaits", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithMultipleAwaits", - FilePath = @"", - LineNumber = 98, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, + TestName = "STA_WithAsyncEnumerable", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithAsyncEnumerable", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 116, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithAsyncEnumerable", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithAsyncEnumerable, + RepeatCount = 100, + }; + metadata_STA_WithAsyncEnumerable.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithTaskWhenAll = new global::TUnit.Core.TestMetadata + { + TestName = "STA_WithTaskWhenAll", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithTaskWhenAll", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 130, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithTaskWhenAll", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithTaskWhenAll, + RepeatCount = 100, + }; + metadata_STA_WithTaskWhenAll.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithExceptionHandling = new global::TUnit.Core.TestMetadata + { + TestName = "STA_WithExceptionHandling", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithExceptionHandling", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 147, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithExceptionHandling", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithExceptionHandling, + RepeatCount = 100, + }; + metadata_STA_WithExceptionHandling.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithThrowsNothingAssertion = new global::TUnit.Core.TestMetadata + { + TestName = "STA_WithThrowsNothingAssertion", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithThrowsNothingAssertion", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 194, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithThrowsNothingAssertion", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithThrowsNothingAssertion, + RepeatCount = 100, + }; + metadata_STA_WithThrowsNothingAssertion.UseRuntimeDataGeneration(testSessionId); + var metadata_STA_WithFuncAssertion = new global::TUnit.Core.TestMetadata + { + TestName = "STA_WithFuncAssertion", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithFuncAssertion", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 211, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithFuncAssertion", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithFuncAssertion, + RepeatCount = 100, + }; + metadata_STA_WithFuncAssertion.UseRuntimeDataGeneration(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 }; + } + public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + { + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.With_STA", + ClassName = "STAThreadTests", + MethodName = "With_STA", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.With_STA", + FilePath = @"", + LineNumber = 14, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_With_STA + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.Without_STA", + ClassName = "STAThreadTests", + MethodName = "Without_STA", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.Without_STA", + FilePath = @"", + LineNumber = 20, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Without_STA + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithSimpleAwait", + ClassName = "STAThreadTests", + MethodName = "STA_WithSimpleAwait", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithSimpleAwait", + FilePath = @"", + LineNumber = 26, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithSimpleAwait + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithTaskYield", + ClassName = "STAThreadTests", + MethodName = "STA_WithTaskYield", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskYield", + FilePath = @"", + LineNumber = 36, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithTaskYield + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithConfigureAwaitTrue", + ClassName = "STAThreadTests", + MethodName = "STA_WithConfigureAwaitTrue", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithConfigureAwaitTrue", + FilePath = @"", + LineNumber = 45, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithConfigureAwaitTrue + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithNestedAsyncCalls", + ClassName = "STAThreadTests", + MethodName = "STA_WithNestedAsyncCalls", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithNestedAsyncCalls", + FilePath = @"", + LineNumber = 54, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithNestedAsyncCalls + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithTaskFromResult", + ClassName = "STAThreadTests", + MethodName = "STA_WithTaskFromResult", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskFromResult", + FilePath = @"", + LineNumber = 64, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithTaskFromResult + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithCompletedTask", + ClassName = "STAThreadTests", + MethodName = "STA_WithCompletedTask", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithCompletedTask", + FilePath = @"", + LineNumber = 74, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithCompletedTask + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithTaskRun", + ClassName = "STAThreadTests", + MethodName = "STA_WithTaskRun", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskRun", + FilePath = @"", + LineNumber = 83, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithTaskRun + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithMultipleAwaits", + ClassName = "STAThreadTests", + MethodName = "STA_WithMultipleAwaits", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithMultipleAwaits", + FilePath = @"", + LineNumber = 98, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithMultipleAwaits + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithAsyncEnumerable", + ClassName = "STAThreadTests", + MethodName = "STA_WithAsyncEnumerable", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithAsyncEnumerable", + FilePath = @"", + LineNumber = 116, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithAsyncEnumerable + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithTaskWhenAll", + ClassName = "STAThreadTests", + MethodName = "STA_WithTaskWhenAll", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskWhenAll", + FilePath = @"", + LineNumber = 130, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithTaskWhenAll + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithExceptionHandling", + ClassName = "STAThreadTests", + MethodName = "STA_WithExceptionHandling", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithExceptionHandling", + FilePath = @"", + LineNumber = 147, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithExceptionHandling + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithThrowsNothingAssertion", + ClassName = "STAThreadTests", + MethodName = "STA_WithThrowsNothingAssertion", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithThrowsNothingAssertion", + FilePath = @"", + LineNumber = 194, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = false, + RepeatCount = 100, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_STA_WithThrowsNothingAssertion + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.STAThreadTests.STA_WithFuncAssertion", + ClassName = "STAThreadTests", + MethodName = "STA_WithFuncAssertion", + FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithFuncAssertion", + FilePath = @"", + LineNumber = 211, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + 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 metadata = new global::TUnit.Core.TestMetadata + { + TestName = "With_STA", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "With_STA", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 14, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "With_STA", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_With_STA, + RepeatCount = 100, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Without_STA(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "Without_STA", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "Without_STA", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_1, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 20, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "Without_STA", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Without_STA, + RepeatCount = 100, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithSimpleAwait(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "STA_WithSimpleAwait", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithSimpleAwait", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 26, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithSimpleAwait", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithSimpleAwait, + RepeatCount = 100, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithTaskYield(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "STA_WithTaskYield", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithTaskYield", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 36, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithTaskYield", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithTaskYield, RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithConfigureAwaitTrue(string testSessionId) { - 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") - ]; + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "STA_WithConfigureAwaitTrue", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithConfigureAwaitTrue", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 45, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithConfigureAwaitTrue", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithConfigureAwaitTrue, + RepeatCount = 100, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithNestedAsyncCalls(string testSessionId) { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithMultipleAwaits()); - } - catch (global::System.Exception ex) + var metadata = new global::TUnit.Core.TestMetadata { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } + TestName = "STA_WithNestedAsyncCalls", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithNestedAsyncCalls", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 54, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithNestedAsyncCalls", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithNestedAsyncCalls, + RepeatCount = 100, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithTaskFromResult(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { - TestName = "STA_WithAsyncEnumerable", + TestName = "STA_WithTaskFromResult", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), - TestMethodName = "STA_WithAsyncEnumerable", + TestMethodName = "STA_WithTaskFromResult", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 116, + LineNumber = 64, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.STAThreadTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STA_WithAsyncEnumerable", + Name = "STA_WithTaskFromResult", GenericTypeCount = 0, ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), @@ -1034,89 +1328,166 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_T Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithTaskFromResult, + RepeatCount = 100, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithCompletedTask(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithAsyncEnumerable", - ClassName = "STAThreadTests", - MethodName = "STA_WithAsyncEnumerable", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithAsyncEnumerable", + TestName = "STA_WithCompletedTask", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithCompletedTask", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", - LineNumber = 116, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, + LineNumber = 74, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithCompletedTask", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithCompletedTask, RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithTaskRun(string testSessionId) { - 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") - ]; + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "STA_WithTaskRun", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithTaskRun", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 83, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithTaskRun", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithTaskRun, + RepeatCount = 100, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithMultipleAwaits(string testSessionId) { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithAsyncEnumerable()); - } - catch (global::System.Exception ex) + var metadata = new global::TUnit.Core.TestMetadata { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } + TestName = "STA_WithMultipleAwaits", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithMultipleAwaits", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 98, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithMultipleAwaits", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithMultipleAwaits, + RepeatCount = 100, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithAsyncEnumerable(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { - TestName = "STA_WithTaskWhenAll", + TestName = "STA_WithAsyncEnumerable", TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), - TestMethodName = "STA_WithTaskWhenAll", + TestMethodName = "STA_WithAsyncEnumerable", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 130, + LineNumber = 116, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.STAThreadTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), - Name = "STA_WithTaskWhenAll", + Name = "STA_WithAsyncEnumerable", GenericTypeCount = 0, ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), @@ -1133,68 +1504,58 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_TestS Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithAsyncEnumerable, + RepeatCount = 100, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithTaskWhenAll(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.STAThreadTests.STA_WithTaskWhenAll", - ClassName = "STAThreadTests", - MethodName = "STA_WithTaskWhenAll", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithTaskWhenAll", + TestName = "STA_WithTaskWhenAll", + TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), + TestMethodName = "STA_WithTaskWhenAll", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", LineNumber = 130, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.STAThreadTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.STAThreadTests)), + Name = "STA_WithTaskWhenAll", + 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.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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithTaskWhenAll, RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithTaskWhenAll()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithExceptionHandling(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -1202,8 +1563,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithExceptionHandling", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -1232,68 +1592,14 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithExceptionHandling, + RepeatCount = 100, }; 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.STAThreadTests.STA_WithExceptionHandling", - ClassName = "STAThreadTests", - MethodName = "STA_WithExceptionHandling", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithExceptionHandling", - FilePath = @"", - LineNumber = 147, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithExceptionHandling()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAssertion_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithThrowsNothingAssertion(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -1301,8 +1607,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAsse TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithThrowsNothingAssertion", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -1331,68 +1636,14 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAsse Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithThrowsNothingAssertion, + RepeatCount = 100, }; 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.STAThreadTests.STA_WithThrowsNothingAssertion", - ClassName = "STAThreadTests", - MethodName = "STA_WithThrowsNothingAssertion", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithThrowsNothingAssertion", - FilePath = @"", - LineNumber = 194, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithThrowsNothingAssertion()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_STA_WithFuncAssertion(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -1400,8 +1651,7 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_Tes TestClassType = typeof(global::TUnit.TestProject.STAThreadTests), TestMethodName = "STA_WithFuncAssertion", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - RepeatCount = 100, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -1430,67 +1680,13 @@ internal sealed class TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_Tes Parent = null }) }, - InstanceFactory = TUnit_TestProject_STAThreadTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_STA_WithFuncAssertion, + RepeatCount = 100, }; 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.STAThreadTests.STA_WithFuncAssertion", - ClassName = "STAThreadTests", - MethodName = "STA_WithFuncAssertion", - FullyQualifiedName = "TUnit.TestProject.STAThreadTests.STA_WithFuncAssertion", - FilePath = @"", - LineNumber = 211, - Categories = global::System.Array.Empty(), - Properties = global::System.Array.Empty(), - HasDataSource = false, - RepeatCount = 100, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.Executors.STAThreadExecutorAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.RunOnAttribute(global::TUnit.Core.Enums.OS.Windows), - new global::TUnit.Core.RepeatAttribute(100), - new global::System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute("Interoperability", "CA1416:Validate platform compatibility") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.STAThreadTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.STA_WithFuncAssertion()); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_STAThreadTests__ClassHelper -{ internal static global::TUnit.TestProject.STAThreadTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.STAThreadTests(); @@ -1498,20 +1694,6 @@ internal static class TUnit_TestProject_STAThreadTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithAsyncEnumerable_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithCompletedTask_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithConfigureAwaitTrue_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithExceptionHandling_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithFuncAssertion_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithMultipleAwaits_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithNestedAsyncCalls_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithSimpleAwait_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithTaskFromResult_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithTaskRun_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithTaskWhenAll_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithTaskYield_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_STA_WithThrowsNothingAssertion_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_With_STA_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests_Without_STA_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.STAThreadTests), new TUnit_TestProject_STAThreadTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/StringArgumentTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/StringArgumentTests.Test.verified.txt index 03ed9cf3f7c..fbfcd1a649a 100644 --- a/TUnit.Core.SourceGenerator.Tests/StringArgumentTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/StringArgumentTests.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_StringArgumentTests_Normal__string_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_StringArgumentTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_Normal__string = new global::TUnit.Core.TestMetadata { TestName = "Normal", TestClassType = typeof(global::TUnit.TestProject.StringArgumentTests), TestMethodName = "Normal", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(""), @@ -26,10 +26,10 @@ internal sealed class TUnit_TestProject_StringArgumentTests_Normal__string_TestS new global::TUnit.Core.ArgumentsAttribute("\\\t"), new global::TUnit.Core.ArgumentsAttribute("\\\\t"), new global::TUnit.Core.ArgumentsAttribute( """ - Hello - World - """ -), + Hello + World + """ + ), }, ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -67,11 +67,69 @@ internal sealed class TUnit_TestProject_StringArgumentTests_Normal__string_TestS Parent = null }) }, - InstanceFactory = TUnit_TestProject_StringArgumentTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Normal__string, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_Normal__string.UseRuntimeDataGeneration(testSessionId); + var metadata_Nullable__string_ = new global::TUnit.Core.TestMetadata + { + TestName = "Nullable", + TestClassType = typeof(global::TUnit.TestProject.StringArgumentTests), + TestMethodName = "Nullable", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 27, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.StringArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.StringArgumentTests)), + Name = "Nullable", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "s", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Nullable", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.StringArgumentTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Nullable__string_, + }; + metadata_Nullable__string_.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_Normal__string, metadata_Nullable__string_ }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -88,10 +146,25 @@ internal sealed class TUnit_TestProject_StringArgumentTests_Normal__string_TestS HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_Normal__string + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.StringArgumentTests.Nullable", + ClassName = "StringArgumentTests", + MethodName = "Nullable", + FullyQualifiedName = "TUnit.TestProject.StringArgumentTests.Nullable", + FilePath = @"", + LineNumber = 27, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Nullable__string_ }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -99,7 +172,7 @@ internal sealed class TUnit_TestProject_StringArgumentTests_Normal__string_TestS new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.StringArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_Normal__string(global::TUnit.TestProject.StringArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -119,29 +192,35 @@ internal sealed class TUnit_TestProject_StringArgumentTests_Normal__string_TestS return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_StringArgumentTests_Nullable__string__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata { - TestName = "Nullable", + TestName = "Normal", TestClassType = typeof(global::TUnit.TestProject.StringArgumentTests), - TestMethodName = "Nullable", + TestMethodName = "Normal", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(""), @@ -151,19 +230,23 @@ internal sealed class TUnit_TestProject_StringArgumentTests_Nullable__string__Te new global::TUnit.Core.ArgumentsAttribute("\\t"), new global::TUnit.Core.ArgumentsAttribute("\\\t"), new global::TUnit.Core.ArgumentsAttribute("\\\\t"), - new global::TUnit.Core.ArgumentsAttribute(null), + new global::TUnit.Core.ArgumentsAttribute( """ + Hello + World + """ + ), }, ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 27, + LineNumber = 8, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.StringArgumentTests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.StringArgumentTests)), - Name = "Nullable", + Name = "Normal", GenericTypeCount = 0, ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), @@ -173,8 +256,8 @@ internal sealed class TUnit_TestProject_StringArgumentTests_Nullable__string__Te { Name = "s", TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), - IsNullable = true, - ReflectionInfo = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Nullable", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Normal", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.StringArgumentTests", new global::TUnit.Core.ClassMetadata @@ -189,72 +272,74 @@ internal sealed class TUnit_TestProject_StringArgumentTests_Nullable__string__Te Parent = null }) }, - InstanceFactory = TUnit_TestProject_StringArgumentTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Normal__string, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Nullable__string_(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.StringArgumentTests.Nullable", - ClassName = "StringArgumentTests", - MethodName = "Nullable", - FullyQualifiedName = "TUnit.TestProject.StringArgumentTests.Nullable", + TestName = "Nullable", + TestClassType = typeof(global::TUnit.TestProject.StringArgumentTests), + TestMethodName = "Nullable", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", LineNumber = 27, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.StringArgumentTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) + MethodMetadata = new global::TUnit.Core.MethodMetadata { - case 1: + Type = typeof(global::TUnit.TestProject.StringArgumentTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.StringArgumentTests)), + Name = "Nullable", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) { - instance.Nullable(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); - return default(global::System.Threading.Tasks.ValueTask); + Name = "s", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.StringArgumentTests).GetMethod("Nullable", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } + }, + Class = 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Nullable__string_, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_StringArgumentTests__ClassHelper -{ internal static global::TUnit.TestProject.StringArgumentTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.StringArgumentTests(); @@ -262,7 +347,6 @@ internal static class TUnit_TestProject_StringArgumentTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.StringArgumentTests), new TUnit_TestProject_StringArgumentTests_Normal__string_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.StringArgumentTests), new TUnit_TestProject_StringArgumentTests_Nullable__string__TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.StringArgumentTests), new TUnit_TestProject_StringArgumentTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/Tests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests.Test.verified.txt index 6872c508a6e..249fed0211a 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_Bugs__1304_Tests_TryParse_InvalidString_ReturnsFailure__string__Canc_9F7FA274_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_Bugs__1304_Tests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_TryParse_InvalidString_ReturnsFailure__string__CancellationToken = new global::TUnit.Core.TestMetadata { TestName = "TryParse_InvalidString_ReturnsFailure", TestClassType = typeof(global::TUnit.TestProject.Bugs._1304.Tests), TestMethodName = "TryParse_InvalidString_ReturnsFailure", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("\"2c48c152-7cb7-4f51-8f01-704454f36e60\""), @@ -67,11 +67,118 @@ internal sealed class TUnit_TestProject_Bugs__1304_Tests_TryParse_InvalidString_ Parent = null }) }, - InstanceFactory = TUnit_TestProject_Bugs__1304_Tests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_TryParse_InvalidString_ReturnsFailure__string__CancellationToken, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_TryParse_InvalidString_ReturnsFailure__string__CancellationToken.UseRuntimeDataGeneration(testSessionId); + var metadata_Parse_InvalidString_ThrowsException__string_ = new global::TUnit.Core.TestMetadata + { + TestName = "Parse_InvalidString_ThrowsException", + TestClassType = typeof(global::TUnit.TestProject.Bugs._1304.Tests), + TestMethodName = "Parse_InvalidString_ThrowsException", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 26, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._1304.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1304.Tests)), + Name = "Parse_InvalidString_ThrowsException", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "input", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1304.Tests).GetMethod("Parse_InvalidString_ThrowsException", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1304.Tests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Parse_InvalidString_ThrowsException__string_, + }; + metadata_Parse_InvalidString_ThrowsException__string_.UseRuntimeDataGeneration(testSessionId); + var metadata_TryParse_ValidString_ReturnsAccountId__string = new global::TUnit.Core.TestMetadata + { + TestName = "TryParse_ValidString_ReturnsAccountId", + TestClassType = typeof(global::TUnit.TestProject.Bugs._1304.Tests), + TestMethodName = "TryParse_ValidString_ReturnsAccountId", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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"), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 38, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._1304.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1304.Tests)), + Name = "TryParse_ValidString_ReturnsAccountId", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "input", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1304.Tests).GetMethod("TryParse_ValidString_ReturnsAccountId", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1304.Tests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_TryParse_ValidString_ReturnsAccountId__string, + }; + metadata_TryParse_ValidString_ReturnsAccountId__string.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_TryParse_InvalidString_ReturnsFailure__string__CancellationToken, metadata_Parse_InvalidString_ThrowsException__string_, metadata_TryParse_ValidString_ReturnsAccountId__string }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -88,10 +195,40 @@ internal sealed class TUnit_TestProject_Bugs__1304_Tests_TryParse_InvalidString_ HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_TryParse_InvalidString_ReturnsFailure__string__CancellationToken + }; + yield return new global::TUnit.Core.TestDescriptor + { + 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 = @"", + LineNumber = 26, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Parse_InvalidString_ThrowsException__string_ + }; + yield return new global::TUnit.Core.TestDescriptor + { + 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 = @"", + LineNumber = 38, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_TryParse_ValidString_ReturnsAccountId__string }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -99,7 +236,7 @@ internal sealed class TUnit_TestProject_Bugs__1304_Tests_TryParse_InvalidString_ new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1304.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + 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 { @@ -119,29 +256,53 @@ internal sealed class TUnit_TestProject_Bugs__1304_Tests_TryParse_InvalidString_ return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_Bugs__1304_Tests_Parse_InvalidString_ThrowsException__string__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata { - TestName = "Parse_InvalidString_ThrowsException", + TestName = "TryParse_InvalidString_ReturnsFailure", TestClassType = typeof(global::TUnit.TestProject.Bugs._1304.Tests), - TestMethodName = "Parse_InvalidString_ThrowsException", + TestMethodName = "TryParse_InvalidString_ReturnsFailure", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("\"2c48c152-7cb7-4f51-8f01-704454f36e60\""), @@ -155,12 +316,12 @@ internal sealed class TUnit_TestProject_Bugs__1304_Tests_Parse_InvalidString_Thr PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 26, + LineNumber = 9, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.Bugs._1304.Tests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1304.Tests)), - Name = "Parse_InvalidString_ThrowsException", + Name = "TryParse_InvalidString_ReturnsFailure", GenericTypeCount = 0, ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), @@ -171,7 +332,14 @@ internal sealed class TUnit_TestProject_Bugs__1304_Tests_Parse_InvalidString_Thr Name = "input", TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), IsNullable = true, - ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1304.Tests).GetMethod("Parse_InvalidString_ThrowsException", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1304.Tests).GetMethod("TryParse_InvalidString_ReturnsFailure", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(global::System.Threading.CancellationToken)) + { + Name = "cancellationToken", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1304.Tests).GetMethod("TryParse_InvalidString_ReturnsFailure", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string), typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[1] } }, Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1304.Tests", new global::TUnit.Core.ClassMetadata @@ -186,72 +354,72 @@ internal sealed class TUnit_TestProject_Bugs__1304_Tests_Parse_InvalidString_Thr Parent = null }) }, - InstanceFactory = TUnit_TestProject_Bugs__1304_Tests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_TryParse_InvalidString_ReturnsFailure__string__CancellationToken, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Parse_InvalidString_ThrowsException__string_(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.Bugs._1304.Tests.Parse_InvalidString_ThrowsException", - ClassName = "Tests", - MethodName = "Parse_InvalidString_ThrowsException", - FullyQualifiedName = "TUnit.TestProject.Bugs._1304.Tests.Parse_InvalidString_ThrowsException", + TestName = "Parse_InvalidString_ThrowsException", + TestClassType = typeof(global::TUnit.TestProject.Bugs._1304.Tests), + TestMethodName = "Parse_InvalidString_ThrowsException", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", LineNumber = 26, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1304.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) + MethodMetadata = new global::TUnit.Core.MethodMetadata { - case 1: + Type = typeof(global::TUnit.TestProject.Bugs._1304.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1304.Tests)), + Name = "Parse_InvalidString_ThrowsException", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) { - return new global::System.Threading.Tasks.ValueTask(instance.Parse_InvalidString_ThrowsException(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + Name = "input", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1304.Tests).GetMethod("Parse_InvalidString_ThrowsException", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } + }, + Class = 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Parse_InvalidString_ThrowsException__string_, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_Bugs__1304_Tests_TryParse_ValidString_ReturnsAccountId__string_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_TryParse_ValidString_ReturnsAccountId__string(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -259,7 +427,7 @@ internal sealed class TUnit_TestProject_Bugs__1304_Tests_TryParse_ValidString_Re TestClassType = typeof(global::TUnit.TestProject.Bugs._1304.Tests), TestMethodName = "TryParse_ValidString_ReturnsAccountId", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute("2c48c152-7cb7-4f51-8f01-704454f36e60"), @@ -301,71 +469,12 @@ internal sealed class TUnit_TestProject_Bugs__1304_Tests_TryParse_ValidString_Re Parent = null }) }, - InstanceFactory = TUnit_TestProject_Bugs__1304_Tests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_TryParse_ValidString_ReturnsAccountId__string, }; 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._1304.Tests.TryParse_ValidString_ReturnsAccountId", - ClassName = "Tests", - MethodName = "TryParse_ValidString_ReturnsAccountId", - FullyQualifiedName = "TUnit.TestProject.Bugs._1304.Tests.TryParse_ValidString_ReturnsAccountId", - FilePath = @"", - LineNumber = 38, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1304.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.TryParse_ValidString_ReturnsAccountId(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_Bugs__1304_Tests__ClassHelper -{ internal static global::TUnit.TestProject.Bugs._1304.Tests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.Bugs._1304.Tests(); @@ -373,8 +482,6 @@ internal static class TUnit_TestProject_Bugs__1304_Tests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._1304.Tests), new TUnit_TestProject_Bugs__1304_Tests_Parse_InvalidString_ThrowsException__string__TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._1304.Tests), new TUnit_TestProject_Bugs__1304_Tests_TryParse_InvalidString_ReturnsFailure__string__Canc_9F7FA274_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._1304.Tests), new TUnit_TestProject_Bugs__1304_Tests_TryParse_ValidString_ReturnsAccountId__string_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._1304.Tests), new TUnit_TestProject_Bugs__1304_Tests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1538.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1538.Test.verified.txt index 4235b69afc1..d0d7a86e436 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1538.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1538.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_Bugs__1538_Tests_Eight_Args__bool_string__string__string__string__st_35276EED_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_Bugs__1538_Tests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_Eight_Args__bool_string__string__string__string__string__string__string_ = new global::TUnit.Core.TestMetadata { TestName = "Eight_Args", TestClassType = typeof(global::TUnit.TestProject.Bugs._1538.Tests), TestMethodName = "Eight_Args", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("EightItems") @@ -126,11 +126,188 @@ internal sealed class TUnit_TestProject_Bugs__1538_Tests_Eight_Args__bool_string Parent = null }) }, - InstanceFactory = TUnit_TestProject_Bugs__1538_Tests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Eight_Args__bool_string__string__string__string__string__string__string_, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_Eight_Args__bool_string__string__string__string__string__string__string_.UseRuntimeDataGeneration(testSessionId); + var metadata_SixteenArgs__bool_string__string__string__string__string__string__string__string__string__string__string__string__string__string__string_ = new global::TUnit.Core.TestMetadata + { + TestName = "SixteenArgs", + TestClassType = typeof(global::TUnit.TestProject.Bugs._1538.Tests), + TestMethodName = "SixteenArgs", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.MethodDataSourceAttribute("SixteenItems") + { + Factory = (dataGeneratorMetadata) => + { + 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)) + { + 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(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 16, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._1538.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1538.Tests)), + Name = "SixteenArgs", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "expectedSuccess", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1538.Tests).GetMethod("SixteenArgs", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "item1", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1538.Tests).GetMethod("SixteenArgs", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string) }, null)!.GetParameters()[1] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "item2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1538.Tests).GetMethod("SixteenArgs", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string) }, null)!.GetParameters()[2] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "item3", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1538.Tests).GetMethod("SixteenArgs", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string) }, null)!.GetParameters()[3] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "item4", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1538.Tests).GetMethod("SixteenArgs", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string) }, null)!.GetParameters()[4] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "item5", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1538.Tests).GetMethod("SixteenArgs", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string) }, null)!.GetParameters()[5] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "item6", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1538.Tests).GetMethod("SixteenArgs", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string) }, null)!.GetParameters()[6] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "item7", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1538.Tests).GetMethod("SixteenArgs", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string) }, null)!.GetParameters()[7] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "item8", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1538.Tests).GetMethod("SixteenArgs", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string) }, null)!.GetParameters()[8] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "item9", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1538.Tests).GetMethod("SixteenArgs", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string) }, null)!.GetParameters()[9] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "item10", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1538.Tests).GetMethod("SixteenArgs", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string) }, null)!.GetParameters()[10] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "item11", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1538.Tests).GetMethod("SixteenArgs", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string) }, null)!.GetParameters()[11] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "item12", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1538.Tests).GetMethod("SixteenArgs", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string) }, null)!.GetParameters()[12] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "item13", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1538.Tests).GetMethod("SixteenArgs", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string) }, null)!.GetParameters()[13] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "item14", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1538.Tests).GetMethod("SixteenArgs", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string) }, null)!.GetParameters()[14] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "item15", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1538.Tests).GetMethod("SixteenArgs", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string) }, null)!.GetParameters()[15] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1538.Tests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SixteenArgs__bool_string__string__string__string__string__string__string__string__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_.UseRuntimeDataGeneration(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_ }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -147,10 +324,25 @@ internal sealed class TUnit_TestProject_Bugs__1538_Tests_Eight_Args__bool_string HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_Eight_Args__bool_string__string__string__string__string__string__string_ + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.Bugs._1538.Tests.SixteenArgs", + ClassName = "Tests", + MethodName = "SixteenArgs", + FullyQualifiedName = "TUnit.TestProject.Bugs._1538.Tests.SixteenArgs", + FilePath = @"", + LineNumber = 16, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + 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() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -158,7 +350,7 @@ internal sealed class TUnit_TestProject_Bugs__1538_Tests_Eight_Args__bool_string new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1538.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + 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 { @@ -178,21 +370,152 @@ internal sealed class TUnit_TestProject_Bugs__1538_Tests_Eight_Args__bool_string return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_Bugs__1538_Tests_SixteenArgs__bool_string__string__string__string__s_972B9C97_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata + { + TestName = "Eight_Args", + TestClassType = typeof(global::TUnit.TestProject.Bugs._1538.Tests), + TestMethodName = "Eight_Args", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = 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(); + } + }, + }, + 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 + { + Type = typeof(global::TUnit.TestProject.Bugs._1538.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1538.Tests)), + Name = "Eight_Args", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "expectedSuccess", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1538.Tests).GetMethod("Eight_Args", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "expectedError", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1538.Tests).GetMethod("Eight_Args", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string) }, null)!.GetParameters()[1] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "expectedT0", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1538.Tests).GetMethod("Eight_Args", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string) }, null)!.GetParameters()[2] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "expectedT1", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1538.Tests).GetMethod("Eight_Args", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string) }, null)!.GetParameters()[3] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "expectedT2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1538.Tests).GetMethod("Eight_Args", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string) }, null)!.GetParameters()[4] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "expectedT3", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1538.Tests).GetMethod("Eight_Args", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string) }, null)!.GetParameters()[5] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "expectedT4", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1538.Tests).GetMethod("Eight_Args", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string) }, null)!.GetParameters()[6] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "expectedT5", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1538.Tests).GetMethod("Eight_Args", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(bool), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string) }, null)!.GetParameters()[7] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1538.Tests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Eight_Args__bool_string__string__string__string__string__string__string_, + }; + metadata.UseRuntimeDataGeneration(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 metadata = new global::TUnit.Core.TestMetadata { @@ -200,7 +523,7 @@ internal sealed class TUnit_TestProject_Bugs__1538_Tests_SixteenArgs__bool_strin TestClassType = typeof(global::TUnit.TestProject.Bugs._1538.Tests), TestMethodName = "SixteenArgs", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("SixteenItems") @@ -367,72 +690,12 @@ internal sealed class TUnit_TestProject_Bugs__1538_Tests_SixteenArgs__bool_strin Parent = null }) }, - InstanceFactory = TUnit_TestProject_Bugs__1538_Tests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_SixteenArgs__bool_string__string__string__string__string__string__string__string__string__string__string__string__string__string__string_, }; 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._1538.Tests.SixteenArgs", - ClassName = "Tests", - MethodName = "SixteenArgs", - FullyQualifiedName = "TUnit.TestProject.Bugs._1538.Tests.SixteenArgs", - FilePath = @"", - LineNumber = 16, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1538.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) - { - case 16: - { - instance.SixteenArgs(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), global::TUnit.Core.Helpers.CastHelper.Cast(args[1]), global::TUnit.Core.Helpers.CastHelper.Cast(args[2]), global::TUnit.Core.Helpers.CastHelper.Cast(args[3]), global::TUnit.Core.Helpers.CastHelper.Cast(args[4]), global::TUnit.Core.Helpers.CastHelper.Cast(args[5]), global::TUnit.Core.Helpers.CastHelper.Cast(args[6]), global::TUnit.Core.Helpers.CastHelper.Cast(args[7]), global::TUnit.Core.Helpers.CastHelper.Cast(args[8]), global::TUnit.Core.Helpers.CastHelper.Cast(args[9]), global::TUnit.Core.Helpers.CastHelper.Cast(args[10]), global::TUnit.Core.Helpers.CastHelper.Cast(args[11]), global::TUnit.Core.Helpers.CastHelper.Cast(args[12]), global::TUnit.Core.Helpers.CastHelper.Cast(args[13]), global::TUnit.Core.Helpers.CastHelper.Cast(args[14]), global::TUnit.Core.Helpers.CastHelper.Cast(args[15])); - return default(global::System.Threading.Tasks.ValueTask); - } - default: - throw new global::System.ArgumentException($"Expected exactly 16 arguments, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_Bugs__1538_Tests__ClassHelper -{ internal static global::TUnit.TestProject.Bugs._1538.Tests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.Bugs._1538.Tests(); @@ -440,7 +703,6 @@ internal static class TUnit_TestProject_Bugs__1538_Tests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._1538.Tests), new TUnit_TestProject_Bugs__1538_Tests_Eight_Args__bool_string__string__string__string__st_35276EED_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._1538.Tests), new TUnit_TestProject_Bugs__1538_Tests_SixteenArgs__bool_string__string__string__string__s_972B9C97_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._1538.Tests), new TUnit_TestProject_Bugs__1538_Tests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1539.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1539.Test.verified.txt index 63805b88d94..0bb32373da1 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1539.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1539.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_Bugs__1539_Tests_Test_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_Bugs__1539_Tests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_Test = new global::TUnit.Core.TestMetadata { TestName = "Test", TestClassType = typeof(global::TUnit.TestProject.Bugs._1539.Tests), TestMethodName = "Test", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -44,11 +44,11 @@ internal sealed class TUnit_TestProject_Bugs__1539_Tests_Test_TestSource : globa Parent = null }) }, - InstanceFactory = TUnit_TestProject_Bugs__1539_Tests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_Test.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_Test }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -65,10 +65,10 @@ internal sealed class TUnit_TestProject_Bugs__1539_Tests_Test_TestSource : globa HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_Test }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -80,7 +80,7 @@ internal sealed class TUnit_TestProject_Bugs__1539_Tests_Test_TestSource : globa new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1539.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_Test(global::TUnit.TestProject.Bugs._1539.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -92,20 +92,49 @@ internal sealed class TUnit_TestProject_Bugs__1539_Tests_Test_TestSource : globa return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_Bugs__1539_Tests__ClassHelper -{ + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "Test", + TestClassType = typeof(global::TUnit.TestProject.Bugs._1539.Tests), + TestMethodName = "Test", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 + { + Type = typeof(global::TUnit.TestProject.Bugs._1539.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1539.Tests)), + Name = "Test", + 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._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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test, + }; + metadata.UseRuntimeDataGeneration(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(); @@ -113,6 +142,6 @@ internal static class TUnit_TestProject_Bugs__1539_Tests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._1539.Tests), new TUnit_TestProject_Bugs__1539_Tests_Test_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._1539.Tests), new TUnit_TestProject_Bugs__1539_Tests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1589.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1589.Test.verified.txt index 864a6b44465..fa51e8004f7 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1589.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1589.Test.verified.txt @@ -5,22 +5,22 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_Bugs__1589_MyTests_Test1_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_Bugs__1589_MyTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_Test1 = new global::TUnit.Core.TestMetadata { TestName = "Test1", TestClassType = typeof(global::TUnit.TestProject.Bugs._1589.MyTests), TestMethodName = "Test1", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ClassDataSourceAttribute() -{Shared = global::TUnit.Core.SharedType.None,}, + {Shared = global::TUnit.Core.SharedType.None,}, }, PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), @@ -57,11 +57,11 @@ internal sealed class TUnit_TestProject_Bugs__1589_MyTests_Test1_TestSource : gl Parent = null }) }, - InstanceFactory = TUnit_TestProject_Bugs__1589_MyTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test1, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_Test1.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_Test1 }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -78,20 +78,20 @@ internal sealed class TUnit_TestProject_Bugs__1589_MyTests_Test1_TestSource : gl HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_Test1 }; } - private static global::System.Attribute[] __CreateAttributes() + 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,} + {Shared = global::TUnit.Core.SharedType.None,} ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1589.MyTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_Test1(global::TUnit.TestProject.Bugs._1589.MyTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -102,20 +102,62 @@ internal sealed class TUnit_TestProject_Bugs__1589_MyTests_Test1_TestSource : gl return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_Bugs__1589_MyTests__ClassHelper -{ + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test1(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "Test1", + TestClassType = typeof(global::TUnit.TestProject.Bugs._1589.MyTests), + TestMethodName = "Test1", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ClassDataSourceAttribute() + {Shared = global::TUnit.Core.SharedType.None,}, + }, + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 15, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._1589.MyTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1589.MyTests)), + Name = "Test1", + 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._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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Bugs._1589.MyFixture)) + { + Name = "myFixture", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1589.MyFixture)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1589.MyTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.Bugs._1589.MyFixture) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test1, + }; + metadata.UseRuntimeDataGeneration(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])); @@ -123,6 +165,6 @@ internal static class TUnit_TestProject_Bugs__1589_MyTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._1589.MyTests), new TUnit_TestProject_Bugs__1589_MyTests_Test1_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._1589.MyTests), new TUnit_TestProject_Bugs__1589_MyTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1594.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1594.Test.verified.txt index 81d5a1667c9..23642148afc 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1594.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1594.Test.verified.txt @@ -5,22 +5,22 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_Bugs__1594_MyTests_Test1_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_Bugs__1594_MyTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_Test1 = new global::TUnit.Core.TestMetadata { TestName = "Test1", TestClassType = typeof(global::TUnit.TestProject.Bugs._1594.MyTests), TestMethodName = "Test1", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ClassDataSourceAttribute() -{Shared = global::TUnit.Core.SharedType.None,}, + {Shared = global::TUnit.Core.SharedType.None,}, }, PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), @@ -57,11 +57,11 @@ internal sealed class TUnit_TestProject_Bugs__1594_MyTests_Test1_TestSource : gl Parent = null }) }, - InstanceFactory = TUnit_TestProject_Bugs__1594_MyTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test1, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_Test1.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_Test1 }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -78,20 +78,20 @@ internal sealed class TUnit_TestProject_Bugs__1594_MyTests_Test1_TestSource : gl HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_Test1 }; } - private static global::System.Attribute[] __CreateAttributes() + 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,} + {Shared = global::TUnit.Core.SharedType.None,} ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1594.MyTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_Test1(global::TUnit.TestProject.Bugs._1594.MyTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -103,20 +103,62 @@ internal sealed class TUnit_TestProject_Bugs__1594_MyTests_Test1_TestSource : gl return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_Bugs__1594_MyTests__ClassHelper -{ + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test1(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "Test1", + TestClassType = typeof(global::TUnit.TestProject.Bugs._1594.MyTests), + TestMethodName = "Test1", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ClassDataSourceAttribute() + {Shared = global::TUnit.Core.SharedType.None,}, + }, + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 15, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._1594.MyTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1594.MyTests)), + 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._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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Bugs._1594.MyFixture)) + { + Name = "myFixture", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1594.MyFixture)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1594.MyTests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.Bugs._1594.MyFixture) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test1, + }; + metadata.UseRuntimeDataGeneration(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])); @@ -124,6 +166,6 @@ internal static class TUnit_TestProject_Bugs__1594_MyTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._1594.MyTests), new TUnit_TestProject_Bugs__1594_MyTests_Test1_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._1594.MyTests), new TUnit_TestProject_Bugs__1594_MyTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1603.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1603.Test.verified.txt index 1db66413860..8943e92c446 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1603.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1603.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_Bugs__1603_Tests_Casted_Integer_To_Short_Converts__short_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_Bugs__1603_Tests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_Casted_Integer_To_Short_Converts__short = new global::TUnit.Core.TestMetadata { TestName = "Casted_Integer_To_Short_Converts", TestClassType = typeof(global::TUnit.TestProject.Bugs._1603.Tests), TestMethodName = "Casted_Integer_To_Short_Converts", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute((short) -123), @@ -56,11 +56,62 @@ internal sealed class TUnit_TestProject_Bugs__1603_Tests_Casted_Integer_To_Short Parent = null }) }, - InstanceFactory = TUnit_TestProject_Bugs__1603_Tests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Casted_Integer_To_Short_Converts__short, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_Casted_Integer_To_Short_Converts__short.UseRuntimeDataGeneration(testSessionId); + var metadata_Integer_To_Short_Converts__short = new global::TUnit.Core.TestMetadata + { + TestName = "Integer_To_Short_Converts", + TestClassType = typeof(global::TUnit.TestProject.Bugs._1603.Tests), + TestMethodName = "Integer_To_Short_Converts", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(-123), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 15, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._1603.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1603.Tests)), + Name = "Integer_To_Short_Converts", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(short)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(short)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1603.Tests).GetMethod("Integer_To_Short_Converts", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(short) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1603.Tests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Integer_To_Short_Converts__short, + }; + metadata_Integer_To_Short_Converts__short.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_Casted_Integer_To_Short_Converts__short, metadata_Integer_To_Short_Converts__short }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -77,10 +128,25 @@ internal sealed class TUnit_TestProject_Bugs__1603_Tests_Casted_Integer_To_Short HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_Casted_Integer_To_Short_Converts__short + }; + yield return new global::TUnit.Core.TestDescriptor + { + 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 = @"", + LineNumber = 15, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Integer_To_Short_Converts__short }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -88,7 +154,7 @@ internal sealed class TUnit_TestProject_Bugs__1603_Tests_Casted_Integer_To_Short new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1603.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + 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 { @@ -107,44 +173,49 @@ internal sealed class TUnit_TestProject_Bugs__1603_Tests_Casted_Integer_To_Short return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_Bugs__1603_Tests_Integer_To_Short_Converts__short_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata { - TestName = "Integer_To_Short_Converts", + TestName = "Casted_Integer_To_Short_Converts", TestClassType = typeof(global::TUnit.TestProject.Bugs._1603.Tests), - TestMethodName = "Integer_To_Short_Converts", + TestMethodName = "Casted_Integer_To_Short_Converts", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { - new global::TUnit.Core.ArgumentsAttribute(-123), + new global::TUnit.Core.ArgumentsAttribute((short) -123), }, ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 15, + LineNumber = 8, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.Bugs._1603.Tests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1603.Tests)), - Name = "Integer_To_Short_Converts", + Name = "Casted_Integer_To_Short_Converts", GenericTypeCount = 0, ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), @@ -155,7 +226,7 @@ internal sealed class TUnit_TestProject_Bugs__1603_Tests_Integer_To_Short_Conver Name = "value", TypeInfo = new global::TUnit.Core.ConcreteType(typeof(short)), IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1603.Tests).GetMethod("Integer_To_Short_Converts", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(short) }, null)!.GetParameters()[0] + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1603.Tests).GetMethod("Casted_Integer_To_Short_Converts", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(short) }, null)!.GetParameters()[0] } }, Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1603.Tests", new global::TUnit.Core.ClassMetadata @@ -170,71 +241,67 @@ internal sealed class TUnit_TestProject_Bugs__1603_Tests_Integer_To_Short_Conver Parent = null }) }, - InstanceFactory = TUnit_TestProject_Bugs__1603_Tests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Casted_Integer_To_Short_Converts__short, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Integer_To_Short_Converts__short(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - 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", + TestName = "Integer_To_Short_Converts", + TestClassType = typeof(global::TUnit.TestProject.Bugs._1603.Tests), + TestMethodName = "Integer_To_Short_Converts", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(-123), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", LineNumber = 15, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1603.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) + MethodMetadata = new global::TUnit.Core.MethodMetadata { - case 1: + Type = typeof(global::TUnit.TestProject.Bugs._1603.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1603.Tests)), + Name = "Integer_To_Short_Converts", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(short)) { - return new global::System.Threading.Tasks.ValueTask(instance.Integer_To_Short_Converts(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(short)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1603.Tests).GetMethod("Integer_To_Short_Converts", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(short) }, null)!.GetParameters()[0] } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } + }, + Class = 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Integer_To_Short_Converts__short, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_Bugs__1603_Tests__ClassHelper -{ internal static global::TUnit.TestProject.Bugs._1603.Tests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.Bugs._1603.Tests(); @@ -242,7 +309,6 @@ internal static class TUnit_TestProject_Bugs__1603_Tests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._1603.Tests), new TUnit_TestProject_Bugs__1603_Tests_Casted_Integer_To_Short_Converts__short_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._1603.Tests), new TUnit_TestProject_Bugs__1603_Tests_Integer_To_Short_Converts__short_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._1603.Tests), new TUnit_TestProject_Bugs__1603_Tests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1692.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1692.Test.verified.txt index a36883a4fa4..06ec928cdc9 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1692.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1692.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_Bugs__1692_Tests_NullTest__string__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_Bugs__1692_Tests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_NullTest__string_ = new global::TUnit.Core.TestMetadata { TestName = "NullTest", TestClassType = typeof(global::TUnit.TestProject.Bugs._1692.Tests), TestMethodName = "NullTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(null), @@ -57,11 +57,11 @@ internal sealed class TUnit_TestProject_Bugs__1692_Tests_NullTest__string__TestS Parent = null }) }, - InstanceFactory = TUnit_TestProject_Bugs__1692_Tests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_NullTest__string_, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_NullTest__string_.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_NullTest__string_ }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -78,10 +78,10 @@ internal sealed class TUnit_TestProject_Bugs__1692_Tests_NullTest__string__TestS HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_NullTest__string_ }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -89,7 +89,7 @@ internal sealed class TUnit_TestProject_Bugs__1692_Tests_NullTest__string__TestS new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1692.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_NullTest__string_(global::TUnit.TestProject.Bugs._1692.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -108,20 +108,62 @@ internal sealed class TUnit_TestProject_Bugs__1692_Tests_NullTest__string__TestS return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_Bugs__1692_Tests__ClassHelper -{ + private static global::System.Collections.Generic.IReadOnlyList __Materialize_NullTest__string_(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "NullTest", + TestClassType = typeof(global::TUnit.TestProject.Bugs._1692.Tests), + TestMethodName = "NullTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(null), + new global::TUnit.Core.ArgumentsAttribute(null), + }, + 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.Bugs._1692.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1692.Tests)), + Name = "NullTest", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "t", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = true, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1692.Tests).GetMethod("NullTest", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1692.Tests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_NullTest__string_, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } internal static global::TUnit.TestProject.Bugs._1692.Tests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.Bugs._1692.Tests(); @@ -129,6 +171,6 @@ internal static class TUnit_TestProject_Bugs__1692_Tests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._1692.Tests), new TUnit_TestProject_Bugs__1692_Tests_NullTest__string__TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._1692.Tests), new TUnit_TestProject_Bugs__1692_Tests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/Tests1821.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests1821.Test.verified.txt index ae3a47ada61..182223fef94 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests1821.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests1821.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_Bugs__1821_Tests_MethodDataSource__string_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_Bugs__1821_Tests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_MethodDataSource__string = new global::TUnit.Core.TestMetadata { TestName = "MethodDataSource", TestClassType = typeof(global::TUnit.TestProject.Bugs._1821.Tests), TestMethodName = "MethodDataSource", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.InstanceMethodDataSourceAttribute("DataSource"), @@ -68,11 +68,74 @@ internal sealed class TUnit_TestProject_Bugs__1821_Tests_MethodDataSource__strin Parent = null }) }, - InstanceFactory = TUnit_TestProject_Bugs__1821_Tests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MethodDataSource__string, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_MethodDataSource__string.UseRuntimeDataGeneration(testSessionId); + var metadata_MatrixDataSource__string = new global::TUnit.Core.TestMetadata + { + TestName = "MatrixDataSource", + TestClassType = typeof(global::TUnit.TestProject.Bugs._1821.Tests), + TestMethodName = "MatrixDataSource", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.MatrixDataSourceAttribute(), + }, + ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ClassDataSourceAttribute(), + }, + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 16, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._1821.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1821.Tests)), + Name = "MatrixDataSource", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1821.Tests).GetMethod("MatrixDataSource", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1821.Tests", 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Bugs._1821.MyData)) + { + Name = "data", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1821.MyData)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1821.Tests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.Bugs._1821.MyData) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixDataSource__string, + }; + metadata_MatrixDataSource__string.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_MethodDataSource__string, metadata_MatrixDataSource__string }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -89,10 +152,25 @@ internal sealed class TUnit_TestProject_Bugs__1821_Tests_MethodDataSource__strin HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_MethodDataSource__string + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.Bugs._1821.Tests.MatrixDataSource", + ClassName = "Tests", + MethodName = "MatrixDataSource", + FullyQualifiedName = "TUnit.TestProject.Bugs._1821.Tests.MatrixDataSource", + FilePath = @"", + LineNumber = 16, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_MatrixDataSource__string }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -101,7 +179,7 @@ internal sealed class TUnit_TestProject_Bugs__1821_Tests_MethodDataSource__strin new global::TUnit.Core.ClassDataSourceAttribute() ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1821.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + 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 { @@ -120,32 +198,37 @@ internal sealed class TUnit_TestProject_Bugs__1821_Tests_MethodDataSource__strin return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_Bugs__1821_Tests_MatrixDataSource__string_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata { - TestName = "MatrixDataSource", + TestName = "MethodDataSource", TestClassType = typeof(global::TUnit.TestProject.Bugs._1821.Tests), - TestMethodName = "MatrixDataSource", + TestMethodName = "MethodDataSource", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { - new global::TUnit.Core.MatrixDataSourceAttribute(), + new global::TUnit.Core.InstanceMethodDataSourceAttribute("DataSource"), }, ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] { @@ -155,12 +238,12 @@ internal sealed class TUnit_TestProject_Bugs__1821_Tests_MatrixDataSource__strin PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 16, + LineNumber = 9, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.Bugs._1821.Tests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1821.Tests)), - Name = "MatrixDataSource", + Name = "MethodDataSource", GenericTypeCount = 0, ReturnType = typeof(global::System.Threading.Tasks.Task), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.Tasks.Task)), @@ -171,7 +254,7 @@ internal sealed class TUnit_TestProject_Bugs__1821_Tests_MatrixDataSource__strin Name = "value", TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1821.Tests).GetMethod("MatrixDataSource", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1821.Tests).GetMethod("MethodDataSource", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } }, Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._1821.Tests", new global::TUnit.Core.ClassMetadata @@ -195,72 +278,79 @@ internal sealed class TUnit_TestProject_Bugs__1821_Tests_MatrixDataSource__strin Parent = null }) }, - InstanceFactory = TUnit_TestProject_Bugs__1821_Tests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MethodDataSource__string, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_MatrixDataSource__string(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.Bugs._1821.Tests.MatrixDataSource", - ClassName = "Tests", - MethodName = "MatrixDataSource", - FullyQualifiedName = "TUnit.TestProject.Bugs._1821.Tests.MatrixDataSource", + TestName = "MatrixDataSource", + TestClassType = typeof(global::TUnit.TestProject.Bugs._1821.Tests), + TestMethodName = "MatrixDataSource", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.MatrixDataSourceAttribute(), + }, + ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ClassDataSourceAttribute(), + }, + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", LineNumber = 16, - 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.ClassDataSourceAttribute() - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._1821.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) + MethodMetadata = new global::TUnit.Core.MethodMetadata { - case 1: + Type = typeof(global::TUnit.TestProject.Bugs._1821.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1821.Tests)), + Name = "MatrixDataSource", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(string)) { - return new global::System.Threading.Tasks.ValueTask(instance.MatrixDataSource(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1821.Tests).GetMethod("MatrixDataSource", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(string) }, null)!.GetParameters()[0] } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } + }, + Class = 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::TUnit.TestProject.Bugs._1821.MyData)) + { + Name = "data", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._1821.MyData)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._1821.Tests).GetConstructor(new global::System.Type[] { typeof(global::TUnit.TestProject.Bugs._1821.MyData) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixDataSource__string, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_Bugs__1821_Tests__ClassHelper -{ 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])); @@ -268,7 +358,6 @@ internal static class TUnit_TestProject_Bugs__1821_Tests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._1821.Tests), new TUnit_TestProject_Bugs__1821_Tests_MatrixDataSource__string_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._1821.Tests), new TUnit_TestProject_Bugs__1821_Tests_MethodDataSource__string_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._1821.Tests), new TUnit_TestProject_Bugs__1821_Tests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/Tests2083.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests2083.Test.verified.txt index ee00c4e0057..e626f9f9dae 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests2083.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests2083.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_Bugs__2083_Tests_MyTest__long_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_Bugs__2083_Tests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_MyTest__long = new global::TUnit.Core.TestMetadata { TestName = "MyTest", TestClassType = typeof(global::TUnit.TestProject.Bugs._2083.Tests), TestMethodName = "MyTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(0), @@ -61,11 +61,11 @@ internal sealed class TUnit_TestProject_Bugs__2083_Tests_MyTest__long_TestSource Parent = null }) }, - InstanceFactory = TUnit_TestProject_Bugs__2083_Tests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MyTest__long, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_MyTest__long.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_MyTest__long }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -82,10 +82,10 @@ internal sealed class TUnit_TestProject_Bugs__2083_Tests_MyTest__long_TestSource HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_MyTest__long }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -93,7 +93,7 @@ internal sealed class TUnit_TestProject_Bugs__2083_Tests_MyTest__long_TestSource new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._2083.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_MyTest__long(global::TUnit.TestProject.Bugs._2083.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -113,20 +113,66 @@ internal sealed class TUnit_TestProject_Bugs__2083_Tests_MyTest__long_TestSource return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_Bugs__2083_Tests__ClassHelper -{ + private static global::System.Collections.Generic.IReadOnlyList __Materialize_MyTest__long(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "MyTest", + TestClassType = typeof(global::TUnit.TestProject.Bugs._2083.Tests), + TestMethodName = "MyTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_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), + }, + 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 + { + Type = typeof(global::TUnit.TestProject.Bugs._2083.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2083.Tests)), + Name = "MyTest", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(long)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(long)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._2083.Tests).GetMethod("MyTest", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(long) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2083.Tests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MyTest__long, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } internal static global::TUnit.TestProject.Bugs._2083.Tests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.Bugs._2083.Tests(); @@ -134,6 +180,6 @@ internal static class TUnit_TestProject_Bugs__2083_Tests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._2083.Tests), new TUnit_TestProject_Bugs__2083_Tests_MyTest__long_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._2083.Tests), new TUnit_TestProject_Bugs__2083_Tests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/Tests2085.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests2085.Test.verified.txt index f5675a49b00..de3f3187f9f 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests2085.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests2085.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_Bugs__2085_Tests_Double_SpecialConsts__double_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_Bugs__2085_Tests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_Double_SpecialConsts__double = new global::TUnit.Core.TestMetadata { TestName = "Double_SpecialConsts", TestClassType = typeof(global::TUnit.TestProject.Bugs._2085.Tests), TestMethodName = "Double_SpecialConsts", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -56,11 +56,62 @@ internal sealed class TUnit_TestProject_Bugs__2085_Tests_Double_SpecialConsts__d Parent = null }) }, - InstanceFactory = TUnit_TestProject_Bugs__2085_Tests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Double_SpecialConsts__double, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_Double_SpecialConsts__double.UseRuntimeDataGeneration(testSessionId); + var metadata_Float_SpecialConsts__float = new global::TUnit.Core.TestMetadata + { + TestName = "Float_SpecialConsts", + TestClassType = typeof(global::TUnit.TestProject.Bugs._2085.Tests), + TestMethodName = "Float_SpecialConsts", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, + FilePath = @"", + LineNumber = 15, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._2085.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2085.Tests)), + Name = "Float_SpecialConsts", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(float)) + { + Name = "d", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(float)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._2085.Tests).GetMethod("Float_SpecialConsts", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(float) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2085.Tests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Float_SpecialConsts__float, + }; + metadata_Float_SpecialConsts__float.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_Double_SpecialConsts__double, metadata_Float_SpecialConsts__float }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -77,10 +128,25 @@ internal sealed class TUnit_TestProject_Bugs__2085_Tests_Double_SpecialConsts__d HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_Double_SpecialConsts__double + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.Bugs._2085.Tests.Float_SpecialConsts", + ClassName = "Tests", + MethodName = "Float_SpecialConsts", + FullyQualifiedName = "TUnit.TestProject.Bugs._2085.Tests.Float_SpecialConsts", + FilePath = @"", + LineNumber = 15, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Float_SpecialConsts__float }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -88,7 +154,7 @@ internal sealed class TUnit_TestProject_Bugs__2085_Tests_Double_SpecialConsts__d new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._2085.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + 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 { @@ -107,29 +173,34 @@ internal sealed class TUnit_TestProject_Bugs__2085_Tests_Double_SpecialConsts__d return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_Bugs__2085_Tests_Float_SpecialConsts__float_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata { - TestName = "Float_SpecialConsts", + TestName = "Double_SpecialConsts", TestClassType = typeof(global::TUnit.TestProject.Bugs._2085.Tests), - TestMethodName = "Float_SpecialConsts", + TestMethodName = "Double_SpecialConsts", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MatrixDataSourceAttribute(), @@ -139,23 +210,23 @@ internal sealed class TUnit_TestProject_Bugs__2085_Tests_Float_SpecialConsts__fl PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 15, + LineNumber = 8, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.Bugs._2085.Tests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2085.Tests)), - Name = "Float_SpecialConsts", + Name = "Double_SpecialConsts", 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[] { - new global::TUnit.Core.ParameterMetadata(typeof(float)) + new global::TUnit.Core.ParameterMetadata(typeof(double)) { Name = "d", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(float)), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(double)), IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._2085.Tests).GetMethod("Float_SpecialConsts", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(float) }, null)!.GetParameters()[0] + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._2085.Tests).GetMethod("Double_SpecialConsts", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(double) }, null)!.GetParameters()[0] } }, Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2085.Tests", new global::TUnit.Core.ClassMetadata @@ -170,71 +241,67 @@ internal sealed class TUnit_TestProject_Bugs__2085_Tests_Float_SpecialConsts__fl Parent = null }) }, - InstanceFactory = TUnit_TestProject_Bugs__2085_Tests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Double_SpecialConsts__double, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Float_SpecialConsts__float(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.Bugs._2085.Tests.Float_SpecialConsts", - ClassName = "Tests", - MethodName = "Float_SpecialConsts", - FullyQualifiedName = "TUnit.TestProject.Bugs._2085.Tests.Float_SpecialConsts", + TestName = "Float_SpecialConsts", + TestClassType = typeof(global::TUnit.TestProject.Bugs._2085.Tests), + TestMethodName = "Float_SpecialConsts", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 = 0, FilePath = @"", LineNumber = 15, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._2085.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) + MethodMetadata = new global::TUnit.Core.MethodMetadata { - case 1: + Type = typeof(global::TUnit.TestProject.Bugs._2085.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2085.Tests)), + Name = "Float_SpecialConsts", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(float)) { - return new global::System.Threading.Tasks.ValueTask(instance.Float_SpecialConsts(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]))); + Name = "d", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(float)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._2085.Tests).GetMethod("Float_SpecialConsts", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(float) }, null)!.GetParameters()[0] } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } + }, + Class = 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Float_SpecialConsts__float, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_Bugs__2085_Tests__ClassHelper -{ internal static global::TUnit.TestProject.Bugs._2085.Tests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.Bugs._2085.Tests(); @@ -242,7 +309,6 @@ internal static class TUnit_TestProject_Bugs__2085_Tests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._2085.Tests), new TUnit_TestProject_Bugs__2085_Tests_Double_SpecialConsts__double_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._2085.Tests), new TUnit_TestProject_Bugs__2085_Tests_Float_SpecialConsts__float_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._2085.Tests), new TUnit_TestProject_Bugs__2085_Tests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/Tests2112.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/Tests2112.Test.verified.txt index 54e3faab1e0..eecd1b9fcf9 100644 --- a/TUnit.Core.SourceGenerator.Tests/Tests2112.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/Tests2112.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_Bugs__2112_Tests_Test__int_long___TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_Bugs__2112_Tests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_Test__int_long__ = new global::TUnit.Core.TestMetadata { TestName = "Test", TestClassType = typeof(global::TUnit.TestProject.Bugs._2112.Tests), TestMethodName = "Test", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(0, 1L), @@ -64,11 +64,70 @@ internal sealed class TUnit_TestProject_Bugs__2112_Tests_Test__int_long___TestSo Parent = null }) }, - InstanceFactory = TUnit_TestProject_Bugs__2112_Tests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test__int_long__, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_Test__int_long__.UseRuntimeDataGeneration(testSessionId); + var metadata_Test2__int_long__ = new global::TUnit.Core.TestMetadata + { + TestName = "Test2", + TestClassType = typeof(global::TUnit.TestProject.Bugs._2112.Tests), + TestMethodName = "Test2", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(0, 1L, 2L, 3L), + new global::TUnit.Core.ArgumentsAttribute(0, 1L, 2L, 3L), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 15, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.Bugs._2112.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2112.Tests)), + Name = "Test2", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "a", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._2112.Tests).GetMethod("Test2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(long[]) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(long[])) + { + Name = "arr", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(long[])), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._2112.Tests).GetMethod("Test2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(long[]) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2112.Tests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test2__int_long__, + }; + metadata_Test2__int_long__.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_Test__int_long__, metadata_Test2__int_long__ }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -85,10 +144,25 @@ internal sealed class TUnit_TestProject_Bugs__2112_Tests_Test__int_long___TestSo HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_Test__int_long__ + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.Bugs._2112.Tests.Test2", + ClassName = "Tests", + MethodName = "Test2", + FullyQualifiedName = "TUnit.TestProject.Bugs._2112.Tests.Test2", + FilePath = @"", + LineNumber = 15, + Categories = global::System.Array.Empty(), + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_Test2__int_long__ }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -96,7 +170,7 @@ internal sealed class TUnit_TestProject_Bugs__2112_Tests_Test__int_long___TestSo new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._2112.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + 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 { @@ -146,45 +220,81 @@ internal sealed class TUnit_TestProject_Bugs__2112_Tests_Test__int_long___TestSo return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_Bugs__2112_Tests_Test2__int_long___TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + 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 metadata = new global::TUnit.Core.TestMetadata { - TestName = "Test2", + TestName = "Test", TestClassType = typeof(global::TUnit.TestProject.Bugs._2112.Tests), - TestMethodName = "Test2", + TestMethodName = "Test", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { - new global::TUnit.Core.ArgumentsAttribute(0, 1L, 2L, 3L), - new global::TUnit.Core.ArgumentsAttribute(0, 1L, 2L, 3L), + new global::TUnit.Core.ArgumentsAttribute(0, 1L), + new global::TUnit.Core.ArgumentsAttribute(0, 1L), }, ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 15, + LineNumber = 8, MethodMetadata = new global::TUnit.Core.MethodMetadata { Type = typeof(global::TUnit.TestProject.Bugs._2112.Tests), TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2112.Tests)), - Name = "Test2", + Name = "Test", GenericTypeCount = 0, ReturnType = typeof(void), ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), @@ -195,14 +305,14 @@ internal sealed class TUnit_TestProject_Bugs__2112_Tests_Test2__int_long___TestS Name = "a", TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._2112.Tests).GetMethod("Test2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(long[]) }, null)!.GetParameters()[0] + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._2112.Tests).GetMethod("Test", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(long[]) }, null)!.GetParameters()[0] }, new global::TUnit.Core.ParameterMetadata(typeof(long[])) { Name = "arr", TypeInfo = new global::TUnit.Core.ConcreteType(typeof(long[])), IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._2112.Tests).GetMethod("Test2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(long[]) }, null)!.GetParameters()[1] + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._2112.Tests).GetMethod("Test", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(long[]) }, null)!.GetParameters()[1] } }, Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.Bugs._2112.Tests", new global::TUnit.Core.ClassMetadata @@ -217,102 +327,75 @@ internal sealed class TUnit_TestProject_Bugs__2112_Tests_Test2__int_long___TestS Parent = null }) }, - InstanceFactory = TUnit_TestProject_Bugs__2112_Tests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test__int_long__, }; metadata.UseRuntimeDataGeneration(testSessionId); return new global::TUnit.Core.TestMetadata[] { metadata }; } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_Test2__int_long__(string testSessionId) { - yield return new global::TUnit.Core.TestDescriptor + var metadata = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.Bugs._2112.Tests.Test2", - ClassName = "Tests", - MethodName = "Test2", - FullyQualifiedName = "TUnit.TestProject.Bugs._2112.Tests.Test2", + TestName = "Test2", + TestClassType = typeof(global::TUnit.TestProject.Bugs._2112.Tests), + TestMethodName = "Test2", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(0, 1L, 2L, 3L), + new global::TUnit.Core.ArgumentsAttribute(0, 1L, 2L, 3L), + }, + ClassDataSources = global::System.Array.Empty(), + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, FilePath = @"", LineNumber = 15, - 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) - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.Bugs._2112.Tests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - switch (args.Length) + MethodMetadata = new global::TUnit.Core.MethodMetadata { - 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: + Type = typeof(global::TUnit.TestProject.Bugs._2112.Tests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.Bugs._2112.Tests)), + Name = "Test2", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) { - 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: + Name = "a", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._2112.Tests).GetMethod("Test2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(long[]) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(long[])) { - 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); + Name = "arr", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(long[])), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.Bugs._2112.Tests).GetMethod("Test2", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(long[]) }, null)!.GetParameters()[1] } - 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)); - } + }, + Class = 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_Test2__int_long__, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_Bugs__2112_Tests__ClassHelper -{ internal static global::TUnit.TestProject.Bugs._2112.Tests CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.Bugs._2112.Tests(); @@ -320,7 +403,6 @@ internal static class TUnit_TestProject_Bugs__2112_Tests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._2112.Tests), new TUnit_TestProject_Bugs__2112_Tests_Test2__int_long___TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._2112.Tests), new TUnit_TestProject_Bugs__2112_Tests_Test__int_long___TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.Bugs._2112.Tests), new TUnit_TestProject_Bugs__2112_Tests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/TimeoutCancellationTokenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/TimeoutCancellationTokenTests.Test.verified.txt index 08b37a06bc6..183996f2484 100644 --- a/TUnit.Core.SourceGenerator.Tests/TimeoutCancellationTokenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/TimeoutCancellationTokenTests.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_DefaultTest__CancellationToken_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_DefaultTest__CancellationToken = new global::TUnit.Core.TestMetadata { TestName = "DefaultTest", TestClassType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), TestMethodName = "DefaultTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] { @@ -86,74 +86,17 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_DefaultTes Parent = null }) }, - InstanceFactory = TUnit_TestProject_TimeoutCancellationTokenTests__ClassHelper.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.TimeoutCancellationTokenTests.DefaultTest", - ClassName = "TimeoutCancellationTokenTests", - MethodName = "DefaultTest", - FullyQualifiedName = "TUnit.TestProject.TimeoutCancellationTokenTests.DefaultTest", - FilePath = @"", - LineNumber = 14, - Categories = new string[] { "Timeout Cancellation Token Tests" }, - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DefaultTest__CancellationToken, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass), - new global::TUnit.Core.MethodDataSourceAttribute("DataSource"), - new global::TUnit.Core.CategoryAttribute("Timeout Cancellation Token Tests") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.TimeoutCancellationTokenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.DefaultTest(cancellationToken)); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_BasicTest__CancellationToken_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DefaultTest__CancellationToken.UseRuntimeDataGeneration(testSessionId); + var metadata_BasicTest__CancellationToken = new global::TUnit.Core.TestMetadata { TestName = "BasicTest", TestClassType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), TestMethodName = "BasicTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_1, DataSources = global::System.Array.Empty(), ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] { @@ -224,76 +167,17 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_BasicTest_ Parent = null }) }, - InstanceFactory = TUnit_TestProject_TimeoutCancellationTokenTests__ClassHelper.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.TimeoutCancellationTokenTests.BasicTest", - ClassName = "TimeoutCancellationTokenTests", - MethodName = "BasicTest", - FullyQualifiedName = "TUnit.TestProject.TimeoutCancellationTokenTests.BasicTest", - FilePath = @"", - LineNumber = 21, - Categories = new string[] { "Blah", "Timeout Cancellation Token Tests" }, - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_BasicTest__CancellationToken, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.TimeoutAttribute(5_000), - new global::TUnit.Core.CategoryAttribute("Blah"), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Failure), - new global::TUnit.Core.MethodDataSourceAttribute("DataSource"), - new global::TUnit.Core.CategoryAttribute("Timeout Cancellation Token Tests") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.TimeoutCancellationTokenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.BasicTest(cancellationToken)); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_InheritedTimeoutAttribute__CancellationToken_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_BasicTest__CancellationToken.UseRuntimeDataGeneration(testSessionId); + var metadata_InheritedTimeoutAttribute__CancellationToken = new global::TUnit.Core.TestMetadata { TestName = "InheritedTimeoutAttribute", TestClassType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), TestMethodName = "InheritedTimeoutAttribute", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_2, DataSources = global::System.Array.Empty(), ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] { @@ -364,75 +248,17 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_InheritedT Parent = null }) }, - InstanceFactory = TUnit_TestProject_TimeoutCancellationTokenTests__ClassHelper.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.TimeoutCancellationTokenTests.InheritedTimeoutAttribute", - ClassName = "TimeoutCancellationTokenTests", - MethodName = "InheritedTimeoutAttribute", - FullyQualifiedName = "TUnit.TestProject.TimeoutCancellationTokenTests.InheritedTimeoutAttribute", - FilePath = @"", - LineNumber = 30, - Categories = new string[] { "Timeout Cancellation Token Tests" }, - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_InheritedTimeoutAttribute__CancellationToken, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.TestProject.TimeoutCancellationTokenTests.FiveSecondTimeout(), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Failure), - new global::TUnit.Core.MethodDataSourceAttribute("DataSource"), - new global::TUnit.Core.CategoryAttribute("Timeout Cancellation Token Tests") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.TimeoutCancellationTokenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - return new global::System.Threading.Tasks.ValueTask(instance.InheritedTimeoutAttribute(cancellationToken)); - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_DataTest__int_CancellationToken_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_InheritedTimeoutAttribute__CancellationToken.UseRuntimeDataGeneration(testSessionId); + var metadata_DataTest__int_CancellationToken = new global::TUnit.Core.TestMetadata { TestName = "DataTest", TestClassType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), TestMethodName = "DataTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_3, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1), @@ -513,84 +339,17 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_DataTest__ Parent = null }) }, - InstanceFactory = TUnit_TestProject_TimeoutCancellationTokenTests__ClassHelper.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.TimeoutCancellationTokenTests.DataTest", - ClassName = "TimeoutCancellationTokenTests", - MethodName = "DataTest", - FullyQualifiedName = "TUnit.TestProject.TimeoutCancellationTokenTests.DataTest", - FilePath = @"", - LineNumber = 38, - Categories = new string[] { "Timeout Cancellation Token Tests" }, - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataTest__int_CancellationToken, }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ - new global::TUnit.Core.TestAttribute(), - new global::TUnit.Core.TimeoutAttribute(5_000), - new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Failure), - new global::TUnit.Core.MethodDataSourceAttribute("DataSource"), - new global::TUnit.Core.CategoryAttribute("Timeout Cancellation Token Tests") - ]; - } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.TimeoutCancellationTokenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) - { - try - { - var context = global::TUnit.Core.TestContext.Current; - switch (args.Length) - { - case 1: - { - return new global::System.Threading.Tasks.ValueTask(instance.DataTest(global::TUnit.Core.Helpers.CastHelper.Cast(args[0]), context?.Execution.CancellationToken ?? global::System.Threading.CancellationToken.None)); - } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) - { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_DataSourceTest__int_CancellationToken_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) - { - var metadata = new global::TUnit.Core.TestMetadata + metadata_DataTest__int_CancellationToken.UseRuntimeDataGeneration(testSessionId); + var metadata_DataSourceTest__int_CancellationToken = new global::TUnit.Core.TestMetadata { TestName = "DataSourceTest", TestClassType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), TestMethodName = "DataSourceTest", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_4, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("DataSource") @@ -692,34 +451,244 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_DataSource Parent = null }) }, - InstanceFactory = TUnit_TestProject_TimeoutCancellationTokenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSourceTest__int_CancellationToken, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; - } - public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() - { - yield return new global::TUnit.Core.TestDescriptor + metadata_DataSourceTest__int_CancellationToken.UseRuntimeDataGeneration(testSessionId); + var metadata_MatrixTest__int_CancellationToken = new global::TUnit.Core.TestMetadata { - TestId = "TUnit.TestProject.TimeoutCancellationTokenTests.DataSourceTest", - ClassName = "TimeoutCancellationTokenTests", - MethodName = "DataSourceTest", - FullyQualifiedName = "TUnit.TestProject.TimeoutCancellationTokenTests.DataSourceTest", - FilePath = @"", - LineNumber = 48, - Categories = new string[] { "Timeout Cancellation Token Tests" }, - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } - private static global::System.Attribute[] __CreateAttributes() - { - return - [ + TestName = "MatrixTest", + TestClassType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), + TestMethodName = "MatrixTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_5, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.MatrixDataSourceAttribute(), + }, + 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(); + } + }, + }, + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 58, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests)), + Name = "MatrixTest", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).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] + }, + new global::TUnit.Core.ParameterMetadata(typeof(global::System.Threading.CancellationToken)) + { + Name = "cancellationToken", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("MatrixTest", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TimeoutCancellationTokenTests", 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixTest__int_CancellationToken, + }; + metadata_MatrixTest__int_CancellationToken.UseRuntimeDataGeneration(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 }; + } + public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() + { + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.TimeoutCancellationTokenTests.DefaultTest", + ClassName = "TimeoutCancellationTokenTests", + MethodName = "DefaultTest", + FullyQualifiedName = "TUnit.TestProject.TimeoutCancellationTokenTests.DefaultTest", + FilePath = @"", + LineNumber = 14, + Categories = new string[] { "Timeout Cancellation Token Tests" }, + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_DefaultTest__CancellationToken + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.TimeoutCancellationTokenTests.BasicTest", + ClassName = "TimeoutCancellationTokenTests", + MethodName = "BasicTest", + FullyQualifiedName = "TUnit.TestProject.TimeoutCancellationTokenTests.BasicTest", + FilePath = @"", + LineNumber = 21, + Categories = new string[] { "Blah", "Timeout Cancellation Token Tests" }, + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_BasicTest__CancellationToken + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.TimeoutCancellationTokenTests.InheritedTimeoutAttribute", + ClassName = "TimeoutCancellationTokenTests", + MethodName = "InheritedTimeoutAttribute", + FullyQualifiedName = "TUnit.TestProject.TimeoutCancellationTokenTests.InheritedTimeoutAttribute", + FilePath = @"", + LineNumber = 30, + Categories = new string[] { "Timeout Cancellation Token Tests" }, + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_InheritedTimeoutAttribute__CancellationToken + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.TimeoutCancellationTokenTests.DataTest", + ClassName = "TimeoutCancellationTokenTests", + MethodName = "DataTest", + FullyQualifiedName = "TUnit.TestProject.TimeoutCancellationTokenTests.DataTest", + FilePath = @"", + LineNumber = 38, + Categories = new string[] { "Timeout Cancellation Token Tests" }, + Properties = global::System.Array.Empty(), + HasDataSource = true, + RepeatCount = 0, + DependsOn = global::System.Array.Empty(), + Materializer = __Materialize_DataTest__int_CancellationToken + }; + yield return new global::TUnit.Core.TestDescriptor + { + TestId = "TUnit.TestProject.TimeoutCancellationTokenTests.DataSourceTest", + ClassName = "TimeoutCancellationTokenTests", + MethodName = "DataSourceTest", + FullyQualifiedName = "TUnit.TestProject.TimeoutCancellationTokenTests.DataSourceTest", + FilePath = @"", + LineNumber = 48, + Categories = new string[] { "Timeout Cancellation Token Tests" }, + Properties = global::System.Array.Empty(), + 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(), @@ -727,25 +696,680 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_DataSource new global::TUnit.Core.CategoryAttribute("Timeout Cancellation Token Tests") ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.TimeoutCancellationTokenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + 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 metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DefaultTest", + TestClassType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), + TestMethodName = "DefaultTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + 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(); + } + }, + }, + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 14, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests)), + Name = "DefaultTest", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::System.Threading.CancellationToken)) + { + Name = "cancellationToken", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("DefaultTest", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TimeoutCancellationTokenTests", 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DefaultTest__CancellationToken, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_BasicTest__CancellationToken(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "BasicTest", + TestClassType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), + TestMethodName = "BasicTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_1, + DataSources = global::System.Array.Empty(), + 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(); + } + }, + }, + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 21, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests)), + Name = "BasicTest", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::System.Threading.CancellationToken)) + { + Name = "cancellationToken", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("BasicTest", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TimeoutCancellationTokenTests", 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_BasicTest__CancellationToken, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_InheritedTimeoutAttribute__CancellationToken(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "InheritedTimeoutAttribute", + TestClassType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), + TestMethodName = "InheritedTimeoutAttribute", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_2, + DataSources = global::System.Array.Empty(), + 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(); + } + }, + }, + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 30, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests)), + Name = "InheritedTimeoutAttribute", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::System.Threading.CancellationToken)) + { + Name = "cancellationToken", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("InheritedTimeoutAttribute", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TimeoutCancellationTokenTests", 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_InheritedTimeoutAttribute__CancellationToken, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataTest__int_CancellationToken(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataTest", + TestClassType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), + TestMethodName = "DataTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_3, + 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() + { + 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(); + } + }, + }, + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 38, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests)), + Name = "DataTest", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).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] + }, + new global::TUnit.Core.ParameterMetadata(typeof(global::System.Threading.CancellationToken)) + { + Name = "cancellationToken", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("DataTest", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TimeoutCancellationTokenTests", 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataTest__int_CancellationToken, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSourceTest__int_CancellationToken(string testSessionId) { - try + var metadata = new global::TUnit.Core.TestMetadata { - var context = global::TUnit.Core.TestContext.Current; - switch (args.Length) + TestName = "DataSourceTest", + TestClassType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), + TestMethodName = "DataSourceTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_4, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] { - case 1: + new global::TUnit.Core.MethodDataSourceAttribute("DataSource") + { + Factory = (dataGeneratorMetadata) => { - 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)); + 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(); } - default: - throw new global::System.ArgumentException($"Expected exactly 1 argument, but got {args.Length}"); - } - } - catch (global::System.Exception ex) + }, + }, + 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(); + } + }, + }, + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 48, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests)), + Name = "DataSourceTest", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).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] + }, + new global::TUnit.Core.ParameterMetadata(typeof(global::System.Threading.CancellationToken)) + { + Name = "cancellationToken", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("DataSourceTest", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TimeoutCancellationTokenTests", 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSourceTest__int_CancellationToken, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } + private static global::System.Collections.Generic.IReadOnlyList __Materialize_MatrixTest__int_CancellationToken(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata { - return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); - } + TestName = "MatrixTest", + TestClassType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), + TestMethodName = "MatrixTest", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_5, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.MatrixDataSourceAttribute(), + }, + 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(); + } + }, + }, + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 58, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests)), + Name = "MatrixTest", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).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] + }, + new global::TUnit.Core.ParameterMetadata(typeof(global::System.Threading.CancellationToken)) + { + Name = "cancellationToken", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("MatrixTest", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[1] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TimeoutCancellationTokenTests", 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_MatrixTest__int_CancellationToken, + }; + metadata.UseRuntimeDataGeneration(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])); + } + [global::System.Runtime.CompilerServices.ModuleInitializer] + internal static void Initialize() + { + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), new TUnit_TestProject_TimeoutCancellationTokenTests__TestSource()); } } @@ -759,21 +1383,18 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_DataSource namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_MatrixTest__int_CancellationToken_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_TimeoutDoesNotFireTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_QuickTestDoesNotTimeout__CancellationToken = new global::TUnit.Core.TestMetadata { - TestName = "MatrixTest", - TestClassType = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), - TestMethodName = "MatrixTest", + TestName = "QuickTestDoesNotTimeout", + TestClassType = typeof(global::TUnit.TestProject.TimeoutDoesNotFireTests), + TestMethodName = "QuickTestDoesNotTimeout", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, - DataSources = new global::TUnit.Core.IDataSourceAttribute[] - { - new global::TUnit.Core.MatrixDataSourceAttribute(), - }, + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("DataSource") @@ -782,7 +1403,7 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_MatrixTest { async global::System.Collections.Generic.IAsyncEnumerable>> Factory() { - var result = global::TUnit.TestProject.TimeoutCancellationTokenTests.DataSource(); + var result = global::TUnit.TestProject.TimeoutDoesNotFireTests.DataSource(); if (result is global::System.Collections.IEnumerable enumerable && !(result is string)) { foreach (var item in enumerable) @@ -803,37 +1424,30 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_MatrixTest PropertyInjections = global::System.Array.Empty(), InheritanceDepth = 0, FilePath = @"", - LineNumber = 58, + LineNumber = 86, MethodMetadata = new global::TUnit.Core.MethodMetadata { - Type = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests)), - Name = "MatrixTest", + Type = typeof(global::TUnit.TestProject.TimeoutDoesNotFireTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TimeoutDoesNotFireTests)), + Name = "QuickTestDoesNotTimeout", 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[] { - new global::TUnit.Core.ParameterMetadata(typeof(int)) - { - Name = "value", - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), - IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).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] - }, new global::TUnit.Core.ParameterMetadata(typeof(global::System.Threading.CancellationToken)) { Name = "cancellationToken", TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetMethod("MatrixTest", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[1] + ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutDoesNotFireTests).GetMethod("QuickTestDoesNotTimeout", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[0] } }, - Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TimeoutCancellationTokenTests", new global::TUnit.Core.ClassMetadata + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TimeoutDoesNotFireTests", new global::TUnit.Core.ClassMetadata { - Type = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), - TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests)), - Name = "TimeoutCancellationTokenTests", + 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[] @@ -843,84 +1457,60 @@ internal sealed class TUnit_TestProject_TimeoutCancellationTokenTests_MatrixTest Name = "value", TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), IsNullable = false, - ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0] + ReflectionInfo = typeof(global::TUnit.TestProject.TimeoutDoesNotFireTests).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0] } }, Properties = global::System.Array.Empty(), Parent = null }) }, - InstanceFactory = TUnit_TestProject_TimeoutCancellationTokenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_QuickTestDoesNotTimeout__CancellationToken, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_QuickTestDoesNotTimeout__CancellationToken.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_QuickTestDoesNotTimeout__CancellationToken }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { yield return new global::TUnit.Core.TestDescriptor { - TestId = "TUnit.TestProject.TimeoutCancellationTokenTests.MatrixTest", - ClassName = "TimeoutCancellationTokenTests", - MethodName = "MatrixTest", - FullyQualifiedName = "TUnit.TestProject.TimeoutCancellationTokenTests.MatrixTest", + TestId = "TUnit.TestProject.TimeoutDoesNotFireTests.QuickTestDoesNotTimeout", + ClassName = "TimeoutDoesNotFireTests", + MethodName = "QuickTestDoesNotTimeout", + FullyQualifiedName = "TUnit.TestProject.TimeoutDoesNotFireTests.QuickTestDoesNotTimeout", FilePath = @"", - LineNumber = 58, - Categories = new string[] { "Blah", "Timeout Cancellation Token Tests" }, + LineNumber = 86, + Categories = new string[] { "Timeout Cancellation Token Tests" }, Properties = global::System.Array.Empty(), HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_QuickTestDoesNotTimeout__CancellationToken }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { 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.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(global::TUnit.TestProject.TimeoutCancellationTokenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_QuickTestDoesNotTimeout__CancellationToken(global::TUnit.TestProject.TimeoutDoesNotFireTests 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}"); - } + 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)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_TimeoutDoesNotFireTests_QuickTestDoesNotTimeout__CancellationToken_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource -{ - public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) + private static global::System.Collections.Generic.IReadOnlyList __Materialize_QuickTestDoesNotTimeout__CancellationToken(string testSessionId) { var metadata = new global::TUnit.Core.TestMetadata { @@ -928,7 +1518,7 @@ internal sealed class TUnit_TestProject_TimeoutDoesNotFireTests_QuickTestDoesNot TestClassType = typeof(global::TUnit.TestProject.TimeoutDoesNotFireTests), TestMethodName = "QuickTestDoesNotTimeout", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] { @@ -999,51 +1589,20 @@ internal sealed class TUnit_TestProject_TimeoutDoesNotFireTests_QuickTestDoesNot Parent = null }) }, - InstanceFactory = TUnit_TestProject_TimeoutDoesNotFireTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_QuickTestDoesNotTimeout__CancellationToken, }; 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.TimeoutDoesNotFireTests.QuickTestDoesNotTimeout", - ClassName = "TimeoutDoesNotFireTests", - MethodName = "QuickTestDoesNotTimeout", - FullyQualifiedName = "TUnit.TestProject.TimeoutDoesNotFireTests.QuickTestDoesNotTimeout", - FilePath = @"", - LineNumber = 86, - Categories = new string[] { "Timeout Cancellation Token Tests" }, - Properties = global::System.Array.Empty(), - HasDataSource = true, - RepeatCount = 0, - DependsOn = global::System.Array.Empty(), - Materializer = GetTests - }; - } - private static global::System.Attribute[] __CreateAttributes() + internal static global::TUnit.TestProject.TimeoutDoesNotFireTests CreateInstance(global::System.Type[] typeArgs, object?[] args) { - 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") - ]; + return new global::TUnit.TestProject.TimeoutDoesNotFireTests(global::TUnit.Core.Helpers.CastHelper.Cast(args[0])); } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.TimeoutDoesNotFireTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + [global::System.Runtime.CompilerServices.ModuleInitializer] + internal static void Initialize() { - 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)); - } + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.TimeoutDoesNotFireTests), new TUnit_TestProject_TimeoutDoesNotFireTests__TestSource()); } } @@ -1057,17 +1616,17 @@ internal sealed class TUnit_TestProject_TimeoutDoesNotFireTests_QuickTestDoesNot namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_CancellationTokenTriggeredTests_CancellationTokenIsTriggered__Cancel_38B13F70_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_CancellationTokenTriggeredTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_CancellationTokenIsTriggered__CancellationToken = new global::TUnit.Core.TestMetadata { TestName = "CancellationTokenIsTriggered", TestClassType = typeof(global::TUnit.TestProject.CancellationTokenTriggeredTests), TestMethodName = "CancellationTokenIsTriggered", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[] { @@ -1138,11 +1697,11 @@ internal sealed class TUnit_TestProject_CancellationTokenTriggeredTests_Cancella Parent = null }) }, - InstanceFactory = TUnit_TestProject_CancellationTokenTriggeredTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_CancellationTokenIsTriggered__CancellationToken, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_CancellationTokenIsTriggered__CancellationToken.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_CancellationTokenIsTriggered__CancellationToken }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -1159,10 +1718,10 @@ internal sealed class TUnit_TestProject_CancellationTokenTriggeredTests_Cancella HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_CancellationTokenIsTriggered__CancellationToken }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -1173,7 +1732,7 @@ internal sealed class TUnit_TestProject_CancellationTokenTriggeredTests_Cancella new global::TUnit.Core.CategoryAttribute("Timeout Cancellation Token Tests") ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.CancellationTokenTriggeredTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_CancellationTokenIsTriggered__CancellationToken(global::TUnit.TestProject.CancellationTokenTriggeredTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -1184,71 +1743,91 @@ internal sealed class TUnit_TestProject_CancellationTokenTriggeredTests_Cancella return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_TimeoutCancellationTokenTests__ClassHelper -{ - 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])); - } - [global::System.Runtime.CompilerServices.ModuleInitializer] - internal static void Initialize() - { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), new TUnit_TestProject_TimeoutCancellationTokenTests_BasicTest__CancellationToken_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), new TUnit_TestProject_TimeoutCancellationTokenTests_DataSourceTest__int_CancellationToken_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), new TUnit_TestProject_TimeoutCancellationTokenTests_DataTest__int_CancellationToken_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), new TUnit_TestProject_TimeoutCancellationTokenTests_DefaultTest__CancellationToken_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), new TUnit_TestProject_TimeoutCancellationTokenTests_InheritedTimeoutAttribute__CancellationToken_TestSource()); - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.TimeoutCancellationTokenTests), new TUnit_TestProject_TimeoutCancellationTokenTests_MatrixTest__int_CancellationToken_TestSource()); - } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_TimeoutDoesNotFireTests__ClassHelper -{ - 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])); - } - [global::System.Runtime.CompilerServices.ModuleInitializer] - internal static void Initialize() + private static global::System.Collections.Generic.IReadOnlyList __Materialize_CancellationTokenIsTriggered__CancellationToken(string testSessionId) { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.TimeoutDoesNotFireTests), new TUnit_TestProject_TimeoutDoesNotFireTests_QuickTestDoesNotTimeout__CancellationToken_TestSource()); + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "CancellationTokenIsTriggered", + TestClassType = typeof(global::TUnit.TestProject.CancellationTokenTriggeredTests), + TestMethodName = "CancellationTokenIsTriggered", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = global::System.Array.Empty(), + 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.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(); + } + }, + }, + PropertyDataSources = global::System.Array.Empty(), + PropertyInjections = global::System.Array.Empty(), + InheritanceDepth = 0, + FilePath = @"", + LineNumber = 106, + MethodMetadata = new global::TUnit.Core.MethodMetadata + { + Type = typeof(global::TUnit.TestProject.CancellationTokenTriggeredTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.CancellationTokenTriggeredTests)), + Name = "CancellationTokenIsTriggered", + 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(global::System.Threading.CancellationToken)) + { + Name = "cancellationToken", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::System.Threading.CancellationToken)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.CancellationTokenTriggeredTests).GetMethod("CancellationTokenIsTriggered", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(global::System.Threading.CancellationToken) }, null)!.GetParameters()[0] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.CancellationTokenTriggeredTests", 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[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.CancellationTokenTriggeredTests).GetConstructor(new global::System.Type[] { typeof(int) })!.GetParameters()[0] + } + }, + Properties = global::System.Array.Empty(), + Parent = null + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_CancellationTokenIsTriggered__CancellationToken, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_CancellationTokenTriggeredTests__ClassHelper -{ 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])); @@ -1256,6 +1835,6 @@ internal static class TUnit_TestProject_CancellationTokenTriggeredTests__ClassHe [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.CancellationTokenTriggeredTests), new TUnit_TestProject_CancellationTokenTriggeredTests_CancellationTokenIsTriggered__Cancel_38B13F70_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.CancellationTokenTriggeredTests), new TUnit_TestProject_CancellationTokenTriggeredTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/TupleDataSourceDrivenTests.Test.verified.txt b/TUnit.Core.SourceGenerator.Tests/TupleDataSourceDrivenTests.Test.verified.txt index dec1759c857..3bb043f3de9 100644 --- a/TUnit.Core.SourceGenerator.Tests/TupleDataSourceDrivenTests.Test.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/TupleDataSourceDrivenTests.Test.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_TupleMethod__int_string_bool_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_DataSource_TupleMethod__int_string_bool = new global::TUnit.Core.TestMetadata { TestName = "DataSource_TupleMethod", TestClassType = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), TestMethodName = "DataSource_TupleMethod", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.MethodDataSourceAttribute("TupleMethod") @@ -81,11 +81,11 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu Parent = null }) }, - InstanceFactory = TUnit_TestProject_TupleDataSourceDrivenTests__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_TupleMethod__int_string_bool, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_DataSource_TupleMethod__int_string_bool.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_DataSource_TupleMethod__int_string_bool }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -102,10 +102,10 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_DataSource_TupleMethod__int_string_bool }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ @@ -113,7 +113,7 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu new global::TUnit.TestProject.Attributes.EngineTest(global::TUnit.TestProject.Attributes.ExpectedResult.Pass) ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.TupleDataSourceDrivenTests instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + 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) { try { @@ -133,20 +133,86 @@ internal sealed class TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_Tu return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_TupleDataSourceDrivenTests__ClassHelper -{ + private static global::System.Collections.Generic.IReadOnlyList __Materialize_DataSource_TupleMethod__int_string_bool(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "DataSource_TupleMethod", + TestClassType = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), + TestMethodName = "DataSource_TupleMethod", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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(); + } + }, + }, + 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 + { + Type = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests)), + Name = "DataSource_TupleMethod", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "value", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.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] + }, + new global::TUnit.Core.ParameterMetadata(typeof(string)) + { + Name = "value2", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(string)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string), typeof(bool) }, null)!.GetParameters()[1] + }, + new global::TUnit.Core.ParameterMetadata(typeof(bool)) + { + Name = "value3", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(bool)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests).GetMethod("DataSource_TupleMethod", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(string), typeof(bool) }, null)!.GetParameters()[2] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("TestsBase`1:global::TUnit.TestProject.TupleDataSourceDrivenTests", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_DataSource_TupleMethod__int_string_bool, + }; + metadata.UseRuntimeDataGeneration(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(); @@ -154,6 +220,6 @@ internal static class TUnit_TestProject_TupleDataSourceDrivenTests__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), new TUnit_TestProject_TupleDataSourceDrivenTests_DataSource_TupleMethod__int_string_bool_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.TupleDataSourceDrivenTests), new TUnit_TestProject_TupleDataSourceDrivenTests__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_AotSafeDataSourceFactories.verified.txt b/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_AotSafeDataSourceFactories.verified.txt index 6d459dbda53..9cd86b39cfe 100644 --- a/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_AotSafeDataSourceFactories.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_AotSafeDataSourceFactories.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_AotDataSourceTest_TestWithDataSource__int_int_int_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_AotDataSourceTest__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_TestWithDataSource__int_int_int = new global::TUnit.Core.TestMetadata { TestName = "TestWithDataSource", TestClassType = typeof(global::TUnit.TestProject.AotDataSourceTest), TestMethodName = "TestWithDataSource", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = new global::TUnit.Core.IDataSourceAttribute[] { new global::TUnit.Core.ArgumentsAttribute(1, 2, 3), @@ -71,11 +71,11 @@ internal sealed class TUnit_TestProject_AotDataSourceTest_TestWithDataSource__in Parent = null }) }, - InstanceFactory = TUnit_TestProject_AotDataSourceTest__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_TestWithDataSource__int_int_int, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_TestWithDataSource__int_int_int.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_TestWithDataSource__int_int_int }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -92,17 +92,17 @@ internal sealed class TUnit_TestProject_AotDataSourceTest_TestWithDataSource__in HasDataSource = true, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_TestWithDataSource__int_int_int }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ new global::TUnit.Core.TestAttribute() ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.AotDataSourceTest instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_TestWithDataSource__int_int_int(global::TUnit.TestProject.AotDataSourceTest instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -122,20 +122,76 @@ internal sealed class TUnit_TestProject_AotDataSourceTest_TestWithDataSource__in return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_AotDataSourceTest__ClassHelper -{ + private static global::System.Collections.Generic.IReadOnlyList __Materialize_TestWithDataSource__int_int_int(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "TestWithDataSource", + TestClassType = typeof(global::TUnit.TestProject.AotDataSourceTest), + TestMethodName = "TestWithDataSource", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + DataSources = new global::TUnit.Core.IDataSourceAttribute[] + { + new global::TUnit.Core.ArgumentsAttribute(1, 2, 3), + new global::TUnit.Core.ArgumentsAttribute(4, 5, 6), + }, + 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 + { + Type = typeof(global::TUnit.TestProject.AotDataSourceTest), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.AotDataSourceTest)), + Name = "TestWithDataSource", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = new global::TUnit.Core.ParameterMetadata[] + { + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "a", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.AotDataSourceTest).GetMethod("TestWithDataSource", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int), typeof(int) }, null)!.GetParameters()[0] + }, + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "b", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.AotDataSourceTest).GetMethod("TestWithDataSource", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int), typeof(int) }, null)!.GetParameters()[1] + }, + new global::TUnit.Core.ParameterMetadata(typeof(int)) + { + Name = "c", + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(int)), + IsNullable = false, + ReflectionInfo = typeof(global::TUnit.TestProject.AotDataSourceTest).GetMethod("TestWithDataSource", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, new global::System.Type[] { typeof(int), typeof(int), typeof(int) }, null)!.GetParameters()[2] + } + }, + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("UnifiedReflectionFreeTests:global::TUnit.TestProject.AotDataSourceTest", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_TestWithDataSource__int_int_int, + }; + metadata.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata }; + } internal static global::TUnit.TestProject.AotDataSourceTest CreateInstance(global::System.Type[] typeArgs, object?[] args) { return new global::TUnit.TestProject.AotDataSourceTest(); @@ -143,6 +199,6 @@ internal static class TUnit_TestProject_AotDataSourceTest__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AotDataSourceTest), new TUnit_TestProject_AotDataSourceTest_TestWithDataSource__int_int_int_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.AotDataSourceTest), new TUnit_TestProject_AotDataSourceTest__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_ConfigurationSupport.verified.txt b/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_ConfigurationSupport.verified.txt index 8a560fb68ca..f815acf9705 100644 --- a/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_ConfigurationSupport.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_ConfigurationSupport.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_ConfigurationTest_TestWithConfiguration_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_ConfigurationTest__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_TestWithConfiguration = new global::TUnit.Core.TestMetadata { TestName = "TestWithConfiguration", TestClassType = typeof(global::TUnit.TestProject.ConfigurationTest), TestMethodName = "TestWithConfiguration", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -44,11 +44,11 @@ internal sealed class TUnit_TestProject_ConfigurationTest_TestWithConfiguration_ Parent = null }) }, - InstanceFactory = TUnit_TestProject_ConfigurationTest__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_TestWithConfiguration, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_TestWithConfiguration.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_TestWithConfiguration }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -65,17 +65,17 @@ internal sealed class TUnit_TestProject_ConfigurationTest_TestWithConfiguration_ HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_TestWithConfiguration }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ new global::TUnit.Core.TestAttribute() ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ConfigurationTest instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_TestWithConfiguration(global::TUnit.TestProject.ConfigurationTest instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -87,20 +87,49 @@ internal sealed class TUnit_TestProject_ConfigurationTest_TestWithConfiguration_ return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_ConfigurationTest__ClassHelper -{ + private static global::System.Collections.Generic.IReadOnlyList __Materialize_TestWithConfiguration(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "TestWithConfiguration", + TestClassType = typeof(global::TUnit.TestProject.ConfigurationTest), + TestMethodName = "TestWithConfiguration", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 + { + Type = typeof(global::TUnit.TestProject.ConfigurationTest), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ConfigurationTest)), + Name = "TestWithConfiguration", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = global::System.Array.Empty(), + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("UnifiedReflectionFreeTests:global::TUnit.TestProject.ConfigurationTest", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_TestWithConfiguration, + }; + metadata.UseRuntimeDataGeneration(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(); @@ -108,6 +137,6 @@ internal static class TUnit_TestProject_ConfigurationTest__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ConfigurationTest), new TUnit_TestProject_ConfigurationTest_TestWithConfiguration_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ConfigurationTest), new TUnit_TestProject_ConfigurationTest__TestSource()); } } 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 d49b1e15a1b..e7759319fa5 100644 --- a/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_ModuleInitializer_Generation.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_ModuleInitializer_Generation.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_ModuleInitializerTest_TestWithModuleInit_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_ModuleInitializerTest__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_TestWithModuleInit = new global::TUnit.Core.TestMetadata { TestName = "TestWithModuleInit", TestClassType = typeof(global::TUnit.TestProject.ModuleInitializerTest), TestMethodName = "TestWithModuleInit", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -44,11 +44,11 @@ internal sealed class TUnit_TestProject_ModuleInitializerTest_TestWithModuleInit Parent = null }) }, - InstanceFactory = TUnit_TestProject_ModuleInitializerTest__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_TestWithModuleInit, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_TestWithModuleInit.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_TestWithModuleInit }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -65,17 +65,17 @@ internal sealed class TUnit_TestProject_ModuleInitializerTest_TestWithModuleInit HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_TestWithModuleInit }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ new global::TUnit.Core.TestAttribute() ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.ModuleInitializerTest instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_TestWithModuleInit(global::TUnit.TestProject.ModuleInitializerTest instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -87,20 +87,49 @@ internal sealed class TUnit_TestProject_ModuleInitializerTest_TestWithModuleInit return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_ModuleInitializerTest__ClassHelper -{ + private static global::System.Collections.Generic.IReadOnlyList __Materialize_TestWithModuleInit(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "TestWithModuleInit", + TestClassType = typeof(global::TUnit.TestProject.ModuleInitializerTest), + TestMethodName = "TestWithModuleInit", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 + { + Type = typeof(global::TUnit.TestProject.ModuleInitializerTest), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.ModuleInitializerTest)), + Name = "TestWithModuleInit", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = global::System.Array.Empty(), + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("UnifiedReflectionFreeTests:global::TUnit.TestProject.ModuleInitializerTest", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_TestWithModuleInit, + }; + metadata.UseRuntimeDataGeneration(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(); @@ -108,6 +137,6 @@ internal static class TUnit_TestProject_ModuleInitializerTest__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ModuleInitializerTest), new TUnit_TestProject_ModuleInitializerTest_TestWithModuleInit_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.ModuleInitializerTest), new TUnit_TestProject_ModuleInitializerTest__TestSource()); } } 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 d0e8f28e2c7..135715bc9bc 100644 --- a/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_StronglyTypedDelegates_Generation.verified.txt +++ b/TUnit.Core.SourceGenerator.Tests/UnifiedReflectionFreeTests.Test_StronglyTypedDelegates_Generation.verified.txt @@ -5,17 +5,17 @@ namespace TUnit.Generated; [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] [global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal sealed class TUnit_TestProject_TypedDelegateTest_TestWithDelegate_TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource +internal sealed class TUnit_TestProject_TypedDelegateTest__TestSource : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource { public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId) { - var metadata = new global::TUnit.Core.TestMetadata + var metadata_TestWithDelegate = new global::TUnit.Core.TestMetadata { TestName = "TestWithDelegate", TestClassType = typeof(global::TUnit.TestProject.TypedDelegateTest), TestMethodName = "TestWithDelegate", Dependencies = global::System.Array.Empty(), - AttributeFactory = __CreateAttributes, + AttributeFactory = __CreateAttributes_0, DataSources = global::System.Array.Empty(), ClassDataSources = global::System.Array.Empty(), PropertyDataSources = global::System.Array.Empty(), @@ -44,11 +44,11 @@ internal sealed class TUnit_TestProject_TypedDelegateTest_TestWithDelegate_TestS Parent = null }) }, - InstanceFactory = TUnit_TestProject_TypedDelegateTest__ClassHelper.CreateInstance, - InvokeTypedTest = __InvokeTest, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_TestWithDelegate, }; - metadata.UseRuntimeDataGeneration(testSessionId); - return new global::TUnit.Core.TestMetadata[] { metadata }; + metadata_TestWithDelegate.UseRuntimeDataGeneration(testSessionId); + return new global::TUnit.Core.TestMetadata[] { metadata_TestWithDelegate }; } public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors() { @@ -65,17 +65,17 @@ internal sealed class TUnit_TestProject_TypedDelegateTest_TestWithDelegate_TestS HasDataSource = false, RepeatCount = 0, DependsOn = global::System.Array.Empty(), - Materializer = GetTests + Materializer = __Materialize_TestWithDelegate }; } - private static global::System.Attribute[] __CreateAttributes() + private static global::System.Attribute[] __CreateAttributes_0() { return [ new global::TUnit.Core.TestAttribute() ]; } - private static global::System.Threading.Tasks.ValueTask __InvokeTest(global::TUnit.TestProject.TypedDelegateTest instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) + private static global::System.Threading.Tasks.ValueTask __InvokeTest_TestWithDelegate(global::TUnit.TestProject.TypedDelegateTest instance, object?[] args, global::System.Threading.CancellationToken cancellationToken) { try { @@ -87,20 +87,49 @@ internal sealed class TUnit_TestProject_TypedDelegateTest_TestWithDelegate_TestS return new global::System.Threading.Tasks.ValueTask(global::System.Threading.Tasks.Task.FromException(ex)); } } -} - - -// ===== FILE SEPARATOR ===== - -// -#pragma warning disable - -#nullable enable -namespace TUnit.Generated; -[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute] -[global::System.CodeDom.Compiler.GeneratedCode("TUnit", "1.0.0.0")] -internal static class TUnit_TestProject_TypedDelegateTest__ClassHelper -{ + private static global::System.Collections.Generic.IReadOnlyList __Materialize_TestWithDelegate(string testSessionId) + { + var metadata = new global::TUnit.Core.TestMetadata + { + TestName = "TestWithDelegate", + TestClassType = typeof(global::TUnit.TestProject.TypedDelegateTest), + TestMethodName = "TestWithDelegate", + Dependencies = global::System.Array.Empty(), + AttributeFactory = __CreateAttributes_0, + 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 + { + Type = typeof(global::TUnit.TestProject.TypedDelegateTest), + TypeInfo = new global::TUnit.Core.ConcreteType(typeof(global::TUnit.TestProject.TypedDelegateTest)), + Name = "TestWithDelegate", + GenericTypeCount = 0, + ReturnType = typeof(void), + ReturnTypeInfo = new global::TUnit.Core.ConcreteType(typeof(void)), + Parameters = global::System.Array.Empty(), + Class = global::TUnit.Core.ClassMetadata.GetOrAdd("UnifiedReflectionFreeTests:global::TUnit.TestProject.TypedDelegateTest", 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 + }) + }, + InstanceFactory = CreateInstance, + InvokeTypedTest = __InvokeTest_TestWithDelegate, + }; + metadata.UseRuntimeDataGeneration(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(); @@ -108,6 +137,6 @@ internal static class TUnit_TestProject_TypedDelegateTest__ClassHelper [global::System.Runtime.CompilerServices.ModuleInitializer] internal static void Initialize() { - global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.TypedDelegateTest), new TUnit_TestProject_TypedDelegateTest_TestWithDelegate_TestSource()); + global::TUnit.Core.SourceRegistrar.Register(typeof(global::TUnit.TestProject.TypedDelegateTest), new TUnit_TestProject_TypedDelegateTest__TestSource()); } } diff --git a/TUnit.Core.SourceGenerator/CodeWriter.cs b/TUnit.Core.SourceGenerator/CodeWriter.cs index 892b4d6066e..f2f6013a642 100644 --- a/TUnit.Core.SourceGenerator/CodeWriter.cs +++ b/TUnit.Core.SourceGenerator/CodeWriter.cs @@ -202,10 +202,19 @@ public ICodeWriter AppendRaw(string multilineText) endIndex--; } - // Process remaining lines + // Process remaining lines, preserving blank lines within the content for (var i = startIndex; i <= endIndex; i++) { - AppendLine(lines[i].TrimEnd()); + var line = lines[i].TrimEnd(); + if (line.Length == 0) + { + // Preserve blank lines by forcing a newline even when already at line start + _builder.AppendLine(); + } + else + { + AppendLine(line); + } } return this; diff --git a/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs b/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs index c36039f2801..a8430254390 100644 --- a/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs +++ b/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs @@ -92,7 +92,7 @@ public void Initialize(IncrementalGeneratorInitializationContext context) { return; } - GenerateClassHelper(context, classGroup); + GeneratePerClassTestSource(context, classGroup); }); context.RegisterSourceOutput(inheritsTestsClassesProvider, @@ -297,6 +297,12 @@ 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 }) + { + return; + } + var writer = new CodeWriter(); GenerateFileHeader(writer); GenerateTestMetadata(writer, testMethod); @@ -1833,9 +1839,9 @@ private static void GenerateTypedInvokers(CodeWriter writer, TestMethodMetadata { if (testMethod is { InheritanceDepth: 0, IsGenericType: false, IsGenericMethod: false }) { - // Non-generic, direct test methods use the shared per-class helper - var classHelperName = FileNameHelper.GetSafeClassHelperName(testMethod.TypeSymbol); - writer.AppendLine($"InstanceFactory = {classHelperName}.CreateInstance,"); + // Non-generic, direct test methods use the shared per-class TestSource + var testSourceName = FileNameHelper.GetSafeTestSourceName(testMethod.TypeSymbol); + writer.AppendLine($"InstanceFactory = {testSourceName}.CreateInstance,"); } else { @@ -2411,6 +2417,224 @@ private static void GenerateModuleInitializer(CodeWriter writer, TestMethodMetad 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 metadata block for one method's contribution to GetTests(). + /// Output: var metadata_{id} = new TestMetadata<T> { ... }; metadata_{id}.UseRuntimeDataGeneration(...); + /// + private static string PreGenerateMetadataBlock( + TestMethodMetadata testMethod, + string className, + string methodId, + int attributeGroupIndex) + { + var writer = new CodeWriter(includeHeader: false); + + writer.AppendLine($"var metadata_{methodId} = new global::TUnit.Core.TestMetadata<{className}>"); + writer.AppendLine("{"); + writer.Indent(); + + writer.AppendLine($"TestName = \"{testMethod.MethodSymbol.Name}\","); + writer.AppendLine($"TestClassType = typeof({className}),"); + writer.AppendLine($"TestMethodName = \"{testMethod.MethodSymbol.Name}\","); + + // Reuse existing helper methods that write to CodeWriter + GenerateDependencies(writer, testMethod.MethodSymbol); + writer.AppendLine($"AttributeFactory = __CreateAttributes_{attributeGroupIndex},"); + GenerateDataSources(writer, testMethod); + GeneratePropertyInjections(writer, testMethod.TypeSymbol, className); + writer.AppendLine("InheritanceDepth = 0,"); + writer.AppendLine($"FilePath = @\"{(testMethod.FilePath ?? "").Replace("\\", "\\\\")}\","); + writer.AppendLine($"LineNumber = {testMethod.LineNumber},"); + + // MethodMetadata + var compilation = testMethod.Context!.Value.SemanticModel.Compilation; + writer.Append("MethodMetadata = "); + SourceInformationWriter.GenerateMethodInformation(writer, compilation, testMethod.TypeSymbol, testMethod.MethodSymbol, null, ','); + + writer.AppendLine($"InstanceFactory = CreateInstance,"); + writer.AppendLine($"InvokeTypedTest = __InvokeTest_{methodId},"); + + // RepeatCount + var repeatCount = ExtractRepeatCount(testMethod.MethodSymbol, testMethod.TypeSymbol); + if (repeatCount.HasValue) + { + writer.AppendLine($"RepeatCount = {repeatCount.Value},"); + } + + writer.Unindent(); + writer.AppendLine("};"); + writer.AppendLine($"metadata_{methodId}.UseRuntimeDataGeneration(testSessionId);"); + + return writer.ToString(); + } + + /// + /// Pre-generates the descriptor block for one method's contribution to EnumerateTestDescriptors(). + /// Output: yield return new TestDescriptor { ..., Materializer = __Materialize_{id} }; + /// + private static string PreGenerateDescriptorBlock(TestMethodMetadata testMethod, string methodId) + { + var writer = new CodeWriter(includeHeader: false); + + 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}"; + + 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("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 = __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). + /// + private static string PreGenerateMaterializerMethod( + TestMethodMetadata testMethod, + string className, + string methodId, + int attributeGroupIndex) + { + var writer = new CodeWriter(includeHeader: false); + + writer.AppendLine($"private static global::System.Collections.Generic.IReadOnlyList __Materialize_{methodId}(string testSessionId)"); + writer.AppendLine("{"); + writer.Indent(); + + // Same metadata as in GetTests, but with a simple 'metadata' variable name + writer.AppendLine($"var metadata = new global::TUnit.Core.TestMetadata<{className}>"); + writer.AppendLine("{"); + writer.Indent(); + + writer.AppendLine($"TestName = \"{testMethod.MethodSymbol.Name}\","); + writer.AppendLine($"TestClassType = typeof({className}),"); + writer.AppendLine($"TestMethodName = \"{testMethod.MethodSymbol.Name}\","); + + GenerateDependencies(writer, testMethod.MethodSymbol); + writer.AppendLine($"AttributeFactory = __CreateAttributes_{attributeGroupIndex},"); + GenerateDataSources(writer, testMethod); + GeneratePropertyInjections(writer, testMethod.TypeSymbol, className); + writer.AppendLine("InheritanceDepth = 0,"); + writer.AppendLine($"FilePath = @\"{(testMethod.FilePath ?? "").Replace("\\", "\\\\")}\","); + writer.AppendLine($"LineNumber = {testMethod.LineNumber},"); + + var compilation = testMethod.Context!.Value.SemanticModel.Compilation; + writer.Append("MethodMetadata = "); + SourceInformationWriter.GenerateMethodInformation(writer, compilation, testMethod.TypeSymbol, testMethod.MethodSymbol, null, ','); + + writer.AppendLine($"InstanceFactory = CreateInstance,"); + writer.AppendLine($"InvokeTypedTest = __InvokeTest_{methodId},"); + + var repeatCount = ExtractRepeatCount(testMethod.MethodSymbol, testMethod.TypeSymbol); + if (repeatCount.HasValue) + { + writer.AppendLine($"RepeatCount = {repeatCount.Value},"); + } + + writer.Unindent(); + writer.AppendLine("};"); + writer.AppendLine("metadata.UseRuntimeDataGeneration(testSessionId);"); + writer.AppendLine("return new global::TUnit.Core.TestMetadata[] { metadata };"); + + writer.Unindent(); + writer.AppendLine("}"); + + return writer.ToString(); + } + + /// + /// 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); + + writer.AppendLine("return"); + writer.AppendLine("["); + writer.Indent(); + testMethod.CompilationContext.AttributeWriter.WriteAttributes(writer, GetTestAttributes(testMethod)); + writer.Unindent(); + writer.AppendLine("];"); + + return writer.ToString(); + } + + /// + /// Pre-generates UnsafeAccessor declarations for init-only properties. + /// Returns empty string if none needed. + /// + private static string PreGenerateReflectionFieldAccessors(INamedTypeSymbol typeSymbol) + { + var writer = new CodeWriter(includeHeader: false); + GenerateReflectionFieldAccessors(writer, typeSymbol); + var result = writer.ToString(); + return string.IsNullOrWhiteSpace(result) ? "" : result; + } + private static IEnumerable GroupMethodsByClass(ImmutableArray methods) { return methods @@ -2420,22 +2644,67 @@ private static IEnumerable GroupMethodsByClass(ImmutableArray m is not null).Select(m => m!).ToList(); + var attrBodies = methodsList.Select(m => PreGenerateAttributeFactoryBody(m)).ToList(); + var bodyToIndex = new Dictionary(); + var distinctBodies = new List(); + foreach (var body in attrBodies) + { + if (!bodyToIndex.ContainsKey(body)) + { + bodyToIndex[body] = distinctBodies.Count; + distinctBodies.Add(body); + } + } + var attrIndexMap = attrBodies.Select(body => bodyToIndex[body]).ToList(); + + // Pre-generate code for each method + var usedMethodIds = new HashSet(); + var methodSourceCodes = new List(); + for (int i = 0; i < methodsList.Count; i++) + { + var m = methodsList[i]; + var methodId = FileNameHelper.GetSafeMethodId(m.MethodSymbol); + + // Ensure unique methodId within the class (handle multiple overloads with same signature) + var originalMethodId = methodId; + var suffix = 2; + while (!usedMethodIds.Add(methodId)) + { + methodId = $"{originalMethodId}_{suffix}"; + suffix++; + } + + var attrGroupIndex = attrIndexMap[i]; + + methodSourceCodes.Add(new TestMethodSourceCode + { + MethodId = methodId, + MetadataCode = PreGenerateMetadataBlock(m, className, methodId, attrGroupIndex), + DescriptorCode = PreGenerateDescriptorBlock(m, methodId), + InvokeTestMethod = PreGenerateInvokeTestMethod(m, className, methodId), + MaterializerMethod = PreGenerateMaterializerMethod(m, className, methodId, attrGroupIndex), + AttributeGroupIndex = attrGroupIndex, + }); + } return new ClassTestGroup { - ClassFullyQualified = typeSymbol.GloballyQualified(), - ClassHelperName = FileNameHelper.GetSafeClassHelperName(typeSymbol), - TestSourceClassNames = g.Select(m => - FileNameHelper.GetDeterministicFileNameForMethod(m!.TypeSymbol, m.MethodSymbol) - .Replace(".g.cs", "_TestSource")) - .OrderBy(static s => s, StringComparer.Ordinal) - .ToEquatableArray(), + ClassFullyQualified = className, + TestSourceName = testSourceName, + Methods = methodSourceCodes.ToEquatableArray(), + AttributeGroups = distinctBodies.ToEquatableArray(), InstanceFactoryBodyCode = InstanceFactoryGenerator.GenerateInstanceFactoryBody(typeSymbol), + ReflectionFieldAccessorsCode = PreGenerateReflectionFieldAccessors(typeSymbol), }; }); } - private static void GenerateClassHelper(SourceProductionContext context, ClassTestGroup classGroup) + private static void GeneratePerClassTestSource(SourceProductionContext context, ClassTestGroup classGroup) { try { @@ -2444,11 +2713,72 @@ private static void GenerateClassHelper(SourceProductionContext context, ClassTe writer.AppendLine("[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute]"); writer.AppendLine($"[global::System.CodeDom.Compiler.GeneratedCode(\"TUnit\", \"{typeof(TestMetadataGenerator).Assembly.GetName().Version}\")]"); - writer.AppendLine($"internal static class {classGroup.ClassHelperName}"); + writer.AppendLine($"internal sealed class {classGroup.TestSourceName} : global::TUnit.Core.Interfaces.SourceGenerator.ITestSource, global::TUnit.Core.Interfaces.SourceGenerator.ITestDescriptorSource"); + writer.AppendLine("{"); + writer.Indent(); + + // Reflection field accessors (for init-only properties with data sources) + if (!string.IsNullOrEmpty(classGroup.ReflectionFieldAccessorsCode)) + { + writer.AppendRaw(classGroup.ReflectionFieldAccessorsCode); + } + + // GetTests() — returns metadata for ALL methods in this class + writer.AppendLine("public global::System.Collections.Generic.IReadOnlyList GetTests(string testSessionId)"); + writer.AppendLine("{"); + writer.Indent(); + + foreach (var method in classGroup.Methods) + { + writer.AppendRaw(method.MetadataCode); + } + + 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(" };"); + + writer.Unindent(); + writer.AppendLine("}"); + + // EnumerateTestDescriptors() — yields descriptors for ALL methods + writer.AppendLine("public global::System.Collections.Generic.IEnumerable EnumerateTestDescriptors()"); writer.AppendLine("{"); writer.Indent(); + foreach (var method in classGroup.Methods) + { + writer.AppendRaw(method.DescriptorCode); + } + writer.Unindent(); + writer.AppendLine("}"); + + // Shared __CreateAttributes_{index} methods + for (int i = 0; i < classGroup.AttributeGroups.Length; i++) + { + writer.AppendLine($"private static global::System.Attribute[] __CreateAttributes_{i}()"); + writer.AppendLine("{"); + writer.Indent(); + writer.AppendRaw(classGroup.AttributeGroups[i]); + writer.Unindent(); + writer.AppendLine("}"); + } - // CreateInstance method + // Per-method __InvokeTest_{id} methods + foreach (var method in classGroup.Methods) + { + writer.AppendRaw(method.InvokeTestMethod); + } + + // Per-method __Materialize_{id} methods (never JIT'd in normal runs) + foreach (var method in classGroup.Methods) + { + writer.AppendRaw(method.MaterializerMethod); + } + + // CreateInstance method (shared for all methods) writer.AppendLine($"internal static {classGroup.ClassFullyQualified} CreateInstance(global::System.Type[] typeArgs, object?[] args)"); writer.AppendLine("{"); writer.Indent(); @@ -2456,32 +2786,27 @@ private static void GenerateClassHelper(SourceProductionContext context, ClassTe writer.Unindent(); writer.AppendLine("}"); - writer.AppendLine(); - - // Batched ModuleInitializer + // ModuleInitializer — registers ONE instance writer.AppendLine("[global::System.Runtime.CompilerServices.ModuleInitializer]"); writer.AppendLine("internal static void Initialize()"); writer.AppendLine("{"); writer.Indent(); - foreach (var testSourceName in classGroup.TestSourceClassNames) - { - writer.AppendLine($"global::TUnit.Core.SourceRegistrar.Register(typeof({classGroup.ClassFullyQualified}), new {testSourceName}());"); - } + writer.AppendLine($"global::TUnit.Core.SourceRegistrar.Register(typeof({classGroup.ClassFullyQualified}), new {classGroup.TestSourceName}());"); writer.Unindent(); writer.AppendLine("}"); writer.Unindent(); writer.AppendLine("}"); - context.AddSource($"{classGroup.ClassHelperName}.g.cs", SourceText.From(writer.ToString(), Encoding.UTF8)); + context.AddSource($"{classGroup.TestSourceName}.g.cs", SourceText.From(writer.ToString(), Encoding.UTF8)); } catch (Exception ex) { context.ReportDiagnostic(Diagnostic.Create( new DiagnosticDescriptor( "TUNIT0998", - "Class Helper Generation Error", - "Failed to generate class helper for {0}: {1}", + "Per-Class TestSource Generation Error", + "Failed to generate per-class TestSource for {0}: {1}", "TUnit", DiagnosticSeverity.Error, true), diff --git a/TUnit.Core.SourceGenerator/Helpers/FileNameHelper.cs b/TUnit.Core.SourceGenerator/Helpers/FileNameHelper.cs index 8edf82cbc02..70987c9cb9b 100644 --- a/TUnit.Core.SourceGenerator/Helpers/FileNameHelper.cs +++ b/TUnit.Core.SourceGenerator/Helpers/FileNameHelper.cs @@ -92,11 +92,11 @@ public static string GetDeterministicFileNameForMethod(INamedTypeSymbol typeSymb } /// - /// Generates a deterministic class helper name for a test class. - /// Format: {Namespace}_{ClassName}__ClassHelper + /// Generates a deterministic per-class TestSource name for a test class. + /// Format: {Namespace}_{ClassName}__TestSource /// Must produce the same name for the same type across both per-class and per-method pipelines. /// - public static string GetSafeClassHelperName(INamedTypeSymbol typeSymbol) + public static string GetSafeTestSourceName(INamedTypeSymbol typeSymbol) { var sb = new StringBuilder(); @@ -137,7 +137,7 @@ public static string GetSafeClassHelperName(INamedTypeSymbol typeSymbol) } var baseName = sb.ToString(); - var helperSuffix = "__ClassHelper"; + var helperSuffix = "__TestSource"; // Truncate and append a hash if the name would exceed the limit const int fileExtLength = 5; // ".g.cs" @@ -151,6 +151,32 @@ public static string GetSafeClassHelperName(INamedTypeSymbol typeSymbol) return baseName + helperSuffix; } + /// + /// Generates a safe unique method identifier within a class. + /// Returns just the method name for non-overloaded methods, + /// or MethodName__ParamType1_ParamType2 for overloads. + /// + public static string GetSafeMethodId(IMethodSymbol methodSymbol) + { + var baseName = SanitizeForFileName(methodSymbol.Name); + + if (methodSymbol.Parameters.Length == 0) + { + return baseName; + } + + var sb = new StringBuilder(baseName); + sb.Append("__"); + for (int i = 0; i < methodSymbol.Parameters.Length; i++) + { + if (i > 0) sb.Append('_'); + sb.Append(SanitizeForFileName( + methodSymbol.Parameters[i].Type.ToDisplayString(SymbolDisplayFormat.MinimallyQualifiedFormat))); + } + + return sb.ToString(); + } + /// /// Computes a deterministic hash code for a string (FNV-1a). /// Unlike string.GetHashCode(), this is stable across processes and platforms. diff --git a/TUnit.Core.SourceGenerator/Models/ClassTestGroup.cs b/TUnit.Core.SourceGenerator/Models/ClassTestGroup.cs index 30a87831b76..377fbf57d0d 100644 --- a/TUnit.Core.SourceGenerator/Models/ClassTestGroup.cs +++ b/TUnit.Core.SourceGenerator/Models/ClassTestGroup.cs @@ -1,8 +1,8 @@ namespace TUnit.Core.SourceGenerator.Models; /// -/// A per-class grouping model for generating shared class helpers. -/// Contains only primitives (no ISymbol references) for incremental caching. +/// A per-class grouping model for generating a consolidated TestSource. +/// Contains only primitives/strings (no ISymbol references) for incremental caching. /// public sealed record ClassTestGroup { @@ -13,19 +13,32 @@ public sealed record ClassTestGroup public required string ClassFullyQualified { get; init; } /// - /// The safe identifier name for the class helper. - /// e.g. "MyNamespace_MyClass__ClassHelper" + /// The safe identifier name for the per-class TestSource. + /// e.g. "MyNamespace_MyClass__TestSource" /// - public required string ClassHelperName { get; init; } + public required string TestSourceName { get; init; } /// - /// The per-method TestSource class names that should be registered in Initialize(). + /// Pre-generated code for each test method in this class. /// - public required EquatableArray TestSourceClassNames { get; init; } + public required EquatableArray Methods { get; init; } + + /// + /// Deduplicated attribute factory method bodies. + /// Index corresponds to TestMethodSourceCode.AttributeGroupIndex. + /// Methods with identical attributes share the same body. + /// + 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; } } diff --git a/TUnit.Core.SourceGenerator/Models/TestMethodSourceCode.cs b/TUnit.Core.SourceGenerator/Models/TestMethodSourceCode.cs new file mode 100644 index 00000000000..bdc18bfe760 --- /dev/null +++ b/TUnit.Core.SourceGenerator/Models/TestMethodSourceCode.cs @@ -0,0 +1,46 @@ +namespace TUnit.Core.SourceGenerator.Models; + +/// +/// Holds all pre-generated C# code for one test method within a per-class TestSource. +/// All fields are primitives/strings for incremental caching (no ISymbol references). +/// +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; } + + /// + /// 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; } + + /// + /// 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; } + + /// + /// Index into the shared AttributeGroups array in ClassTestGroup. + /// Methods with identical attribute factory bodies share the same index. + /// + public required int AttributeGroupIndex { get; init; } +}